// Path: src/main/java/pl/jalokim/propertiestojson/util/exception/ParsePropertiesException.java
// public class ParsePropertiesException extends RuntimeException {
// 
//     private static final long serialVersionUID = 1L;
// 
//     public static final String STRING_RESOLVER_AS_NOT_LAST = "Added some type resolver after " + StringJsonTypeResolver.class.getCanonicalName()
//         + ". This type resolver always should be last when is in configuration of resolvers";
// 
//     public static final String STRING_TO_JSON_RESOLVER_AS_NOT_LAST = "Added some type resolver after " + StringToJsonTypeConverter.class.getCanonicalName()
//         + ". This type resolver always should be last when is in configuration of resolvers";
// 
//     public static final String PROPERTY_KEY_NEEDS_TO_BE_STRING_TYPE = "Unsupported property key type: %s for key: %s, Property key needs to be a string type";
//     public static final String CANNOT_FIND_TYPE_RESOLVER_MSG = "Cannot find valid JSON type resolver for class: '%s'. %n"
//         + "Please consider add sufficient resolver to your resolvers.";
// 
//     public static final String CANNOT_FIND_JSON_TYPE_OBJ = "Cannot find valid JSON type resolver for class: '%s'. %n"
//         + " for property: %s, and object value: %s %n"
//         + "Please consider add sufficient resolver to your resolvers.";
// 
//     public ParsePropertiesException(String message) {
//         super(message);
//     }
// }


import static pl.jalokim.utils.string.StringUtils.concatElementsAsLines;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Optional;
import lombok.Data;
import pl.jalokim.propertiestojson.util.exception.ParsePropertiesException;
                    findDifferenceInSuperClasses(searchContext, resolverClass, instanceClass);
                    findDifferenceForSuperInterfaces(searchContext, resolverClass, getSuperInterfaces(instanceClass));
                }
            }
        }

        if (searchContext.getFoundClasses().isEmpty()) {
            return null;
        }
        if (searchContext.getFoundClasses().size() == 1) {
            return searchContext.getFoundClasses().get(0);
        }

        List<Class<?>> foundClasses = searchContext.getFoundClasses();
        Optional<Class<?>> onlyObjectTypeOpt = foundClasses.stream()
            .filter(type -> !type.isInterface() && !type.isEnum())
            .findAny();
        if (onlyObjectTypeOpt.isPresent()) {
            if (onlyObjectTypeOpt.get() != Object.class) {
                return onlyObjectTypeOpt.get();
            }
            List<Class<?>> foundInterfaces = new ArrayList<>(foundClasses);
            foundInterfaces.remove(onlyObjectTypeOpt.get());

            if (foundInterfaces.size() == 1) {
                return foundInterfaces.get(0);
            }
            foundClasses = foundInterfaces;
        }

// Path: src/main/java/pl/jalokim/propertiestojson/util/exception/ParsePropertiesException.java
// public class ParsePropertiesException extends RuntimeException {
// 
//     private static final long serialVersionUID = 1L;
// 
//     public static final String STRING_RESOLVER_AS_NOT_LAST = "Added some type resolver after " + StringJsonTypeResolver.class.getCanonicalName()
//         + ". This type resolver always should be last when is in configuration of resolvers";
// 
//     public static final String STRING_TO_JSON_RESOLVER_AS_NOT_LAST = "Added some type resolver after " + StringToJsonTypeConverter.class.getCanonicalName()
//         + ". This type resolver always should be last when is in configuration of resolvers";
// 
//     public static final String PROPERTY_KEY_NEEDS_TO_BE_STRING_TYPE = "Unsupported property key type: %s for key: %s, Property key needs to be a string type";
//     public static final String CANNOT_FIND_TYPE_RESOLVER_MSG = "Cannot find valid JSON type resolver for class: '%s'. %n"
//         + "Please consider add sufficient resolver to your resolvers.";
// 
//     public static final String CANNOT_FIND_JSON_TYPE_OBJ = "Cannot find valid JSON type resolver for class: '%s'. %n"
//         + " for property: %s, and object value: %s %n"
//         + "Please consider add sufficient resolver to your resolvers.";
// 
//     public ParsePropertiesException(String message) {
//         super(message);
//     }
// }


// Path: src/main/java/pl/jalokim/propertiestojson/resolvers/hierarchy/HierarchyClassResolver.java
import static pl.jalokim.utils.string.StringUtils.concatElementsAsLines;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Optional;
import lombok.Data;
import pl.jalokim.propertiestojson.util.exception.ParsePropertiesException;

                    findDifferenceInSuperClasses(searchContext, resolverClass, instanceClass);
                    findDifferenceForSuperInterfaces(searchContext, resolverClass, getSuperInterfaces(instanceClass));
                }
            }
        }

        if (searchContext.getFoundClasses().isEmpty()) {
            return null;
        }
        if (searchContext.getFoundClasses().size() == 1) {
            return searchContext.getFoundClasses().get(0);
        }

        List<Class<?>> foundClasses = searchContext.getFoundClasses();
        Optional<Class<?>> onlyObjectTypeOpt = foundClasses.stream()
            .filter(type -> !type.isInterface() && !type.isEnum())
            .findAny();
        if (onlyObjectTypeOpt.isPresent()) {
            if (onlyObjectTypeOpt.get() != Object.class) {
                return onlyObjectTypeOpt.get();
            }
            List<Class<?>> foundInterfaces = new ArrayList<>(foundClasses);
            foundInterfaces.remove(onlyObjectTypeOpt.get());

            if (foundInterfaces.size() == 1) {
                return foundInterfaces.get(0);
            }
            foundClasses = foundInterfaces;
        }

        throw new ParsePropertiesException(String.format(ERROR_MSG,