public <T> Collection<Class<? extends T>> findSubclassesInPackage(final Class<T> superclass, final String... packageName) {
        try (val scanResult = new ClassGraph()
            .acceptPackages(packageName)
            .enableClassInfo()
            .enableInterClassDependencies()
            .ignoreClassVisibility()
            .enableSystemJarsAndModules()
            .removeTemporaryFilesAfterScan()
            .enableAnnotationInfo()
            .scan()) {
            return superclass.isInterface()
                ? new ArrayList<>(scanResult.getClassesImplementing(superclass).loadClasses(superclass))
                : new ArrayList<>(scanResult.getSubclasses(superclass).loadClasses(superclass));
        }
    }
Finds all {@link Class classes} extending or implementing the given superclass below the given package.

@param superclass  The superclass to look for subclasses or implementers.
@param packageName The base package to look in.
@param <T>         The type of the superclass/interface.
@return The - possibly empty - collection of subclasses.
api/cas-server-core-api-util/src/main/java/org/apereo/cas/util/ReflectionUtils.java