// Path: src/main/java/com/michaelfotiadis/validator/annotated/utils/ReflectionUtils.java
// public final class ReflectionUtils {
// 
//     private ReflectionUtils() {
//         // NOOP
//     }
// 
//     /**
//      * Scans all classes accessible from the context class loader which belong to the given package and subpackages.
//      *
//      * @param packageName The base package
//      * @return The classes
//      * @throws ClassNotFoundException
//      * @throws IOException
//      */
//     public static Class[] getClasses(final String packageName) throws ClassNotFoundException, IOException {
//         final ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
//         assert classLoader != null;
//         final String path = packageName.replace('.', '/');
//         final Enumeration<URL> resources = classLoader.getResources(path);
//         final List<File> dirs = new ArrayList<>();
//         while (resources.hasMoreElements()) {
//             final URL resource = resources.nextElement();
//             dirs.add(new File(resource.getFile()));
//         }
//         final ArrayList<Class> classes = new ArrayList<>();
//         for (final File directory : dirs) {
//             classes.addAll(findClasses(directory, packageName));
//         }
//         return classes.toArray(new Class[classes.size()]);
//     }
// 
//     /**
//      * Recursive method used to find all classes in a given directory and subdirs.
//      *
//      * @param directory   The base directory
//      * @param packageName The package name for classes found inside the base directory
//      * @return The classes
//      * @throws ClassNotFoundException
//      */
//     public static List<Class> findClasses(final File directory, final String packageName) throws ClassNotFoundException {
//         final List<Class> classes = new ArrayList<>();
//         if (!directory.exists()) {
//             return classes;
//         }
//         final File[] files = directory.listFiles();
//         if (files != null) {
//             for (final File file : files) {
//                 if (file.isDirectory()) {
//                     assert !file.getName().contains(".");
//                     classes.addAll(findClasses(file, packageName + "." + file.getName()));
//                 } else if (file.getName().endsWith(".class")) {
//                     classes.add(Class.forName(packageName + '.' + file.getName().substring(0, file.getName().length() - 6)));
//                 }
//             }
//         }
//         return classes;
//     }
// 
// }


import com.michaelfotiadis.validator.annotated.utils.ReflectionUtils;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
package com.michaelfotiadis.validator.annotated;



/**
 *
 */
public final class SupportedAnnotationContainer {

    private static final String PACKAGE_NAME = "com.michaelfotiadis.validator.annotated.annotations";
    private static final List<Class> SUPPORTED_CLASSES = new ArrayList<>();

    private SupportedAnnotationContainer() {
        // NOOP
    }

    /*package*/
    static boolean isSupported(final Class<?> type) {
        return getSupportedClasses().contains(type);
    }

    public static List<Class> getSupportedClasses() {
        if (SUPPORTED_CLASSES.isEmpty()) {
            final Class[] supportedArray;
            try {
// Path: src/main/java/com/michaelfotiadis/validator/annotated/utils/ReflectionUtils.java
// public final class ReflectionUtils {
// 
//     private ReflectionUtils() {
//         // NOOP
//     }
// 
//     /**
//      * Scans all classes accessible from the context class loader which belong to the given package and subpackages.
//      *
//      * @param packageName The base package
//      * @return The classes
//      * @throws ClassNotFoundException
//      * @throws IOException
//      */
//     public static Class[] getClasses(final String packageName) throws ClassNotFoundException, IOException {
//         final ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
//         assert classLoader != null;
//         final String path = packageName.replace('.', '/');
//         final Enumeration<URL> resources = classLoader.getResources(path);
//         final List<File> dirs = new ArrayList<>();
//         while (resources.hasMoreElements()) {
//             final URL resource = resources.nextElement();
//             dirs.add(new File(resource.getFile()));
//         }
//         final ArrayList<Class> classes = new ArrayList<>();
//         for (final File directory : dirs) {
//             classes.addAll(findClasses(directory, packageName));
//         }
//         return classes.toArray(new Class[classes.size()]);
//     }
// 
//     /**
//      * Recursive method used to find all classes in a given directory and subdirs.
//      *
//      * @param directory   The base directory
//      * @param packageName The package name for classes found inside the base directory
//      * @return The classes
//      * @throws ClassNotFoundException
//      */
//     public static List<Class> findClasses(final File directory, final String packageName) throws ClassNotFoundException {
//         final List<Class> classes = new ArrayList<>();
//         if (!directory.exists()) {
//             return classes;
//         }
//         final File[] files = directory.listFiles();
//         if (files != null) {
//             for (final File file : files) {
//                 if (file.isDirectory()) {
//                     assert !file.getName().contains(".");
//                     classes.addAll(findClasses(file, packageName + "." + file.getName()));
//                 } else if (file.getName().endsWith(".class")) {
//                     classes.add(Class.forName(packageName + '.' + file.getName().substring(0, file.getName().length() - 6)));
//                 }
//             }
//         }
//         return classes;
//     }
// 
// }


// Path: src/main/java/com/michaelfotiadis/validator/annotated/SupportedAnnotationContainer.java
import com.michaelfotiadis.validator.annotated.utils.ReflectionUtils;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

package com.michaelfotiadis.validator.annotated;



/**
 *
 */
public final class SupportedAnnotationContainer {

    private static final String PACKAGE_NAME = "com.michaelfotiadis.validator.annotated.annotations";
    private static final List<Class> SUPPORTED_CLASSES = new ArrayList<>();

    private SupportedAnnotationContainer() {
        // NOOP
    }

    /*package*/
    static boolean isSupported(final Class<?> type) {
        return getSupportedClasses().contains(type);
    }

    public static List<Class> getSupportedClasses() {
        if (SUPPORTED_CLASSES.isEmpty()) {
            final Class[] supportedArray;
            try {
                supportedArray = ReflectionUtils.getClasses(PACKAGE_NAME);