public Set<Class<?>> scanPackagesForClassesImplementing(Class<?> implementedInterface, String... onlyFromPackages) { ClassInfoList classInfoList = scanResult.getClassesImplementing(implementedInterface.getName()) .filter(ci -> !ci.isAbstract() && !ci.isInterface() && ci.isPublic()); classInfoList = classInfoList .filter(ci -> Arrays.stream(onlyFromPackages) .anyMatch(p -> classMatchesPackage(ci.getName(), p))); return classInfoList.loadClasses().stream().collect(toSet()); }
private static <T> List<Class<?>> searchForPublicConcreteSubTypesOf(final Class<T> type) { String typeName = type.getCanonicalName(); ClassInfoList subTypes = type.isInterface() ? scanResult.getClassesImplementing(typeName) : scanResult.getSubclasses(typeName); List<Class<?>> loadedSubTypes = subTypes.filter(subType -> subType.isPublic() && !subType.isAbstract()).loadClasses(true); return Collections.unmodifiableList(loadedSubTypes); } }
private static <T> List<Class<?>> searchForPublicConcreteSubTypesOf(final Class<T> type) { String typeName = type.getCanonicalName(); ClassInfoList subTypes = type.isInterface() ? scanResult.getClassesImplementing(typeName) : scanResult.getSubclasses(typeName); List<Class<?>> loadedSubTypes = subTypes.filter(subType -> subType.isPublic() && !subType.isAbstract()).loadClasses(true); return Collections.unmodifiableList(loadedSubTypes); } }
if (classInfo != null && classInfo.classpathElementFile == null && !classInfo.isPublic()) { throw new ClassNotFoundException("Classfile for class " + className + " was found in a module, " + "but the context and system classloaders could not load the class, probably because "