Package io.leangen.graphql.util
Class ClassFinder
- java.lang.Object
-
- io.leangen.graphql.util.ClassFinder
-
public class ClassFinder extends Object
Enables discovery of classes that extend or implement a given class. Instances maintain a cache of search results and should be reused for better performance. The cache is thread-safe but allows for multiple search requests to go through if they arrive at exactly the same time. This class operates in best-effort manner and only logs (never rethrows) any exceptions that occur during the search or class loading.
-
-
Field Summary
Fields Modifier and Type Field Description static Predicate<io.github.classgraph.ClassInfo>ALLstatic Predicate<io.github.classgraph.ClassInfo>CONCRETEstatic org.slf4j.Loggerlogstatic Predicate<io.github.classgraph.ClassInfo>NON_IGNOREDstatic Predicate<io.github.classgraph.ClassInfo>PUBLIC
-
Constructor Summary
Constructors Constructor Description ClassFinder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()List<Class<?>>findImplementations(Class<?> superType, Predicate<io.github.classgraph.ClassInfo> filter, String... packages)Searches for the implementations/subtypes of the given class.List<AnnotatedType>findImplementations(AnnotatedType superType, Predicate<io.github.classgraph.ClassInfo> filter, boolean allowMissingGenerics, String... packages)Searches for the implementations/subtypes of the givenAnnotatedType.
-
-
-
Field Detail
-
CONCRETE
public static final Predicate<io.github.classgraph.ClassInfo> CONCRETE
-
NON_IGNORED
public static final Predicate<io.github.classgraph.ClassInfo> NON_IGNORED
-
PUBLIC
public static final Predicate<io.github.classgraph.ClassInfo> PUBLIC
-
ALL
public static final Predicate<io.github.classgraph.ClassInfo> ALL
-
log
public static final org.slf4j.Logger log
-
-
Method Detail
-
findImplementations
public List<AnnotatedType> findImplementations(AnnotatedType superType, Predicate<io.github.classgraph.ClassInfo> filter, boolean allowMissingGenerics, String... packages)
Searches for the implementations/subtypes of the givenAnnotatedType. Only the matching classes are loaded.- Parameters:
superType- The type the implementations/subtypes of which are to be searched forpackages- The packages to limit the search to- Returns:
- A collection of
AnnotatedTypes discovered that implementation/extendsuperType
-
findImplementations
public List<Class<?>> findImplementations(Class<?> superType, Predicate<io.github.classgraph.ClassInfo> filter, String... packages)
Searches for the implementations/subtypes of the given class. Only the matching classes are loaded.- Parameters:
superType- The type the implementations/subtypes of which are to be searched forpackages- The packages to limit the search to- Returns:
- A collection of classes discovered that implementation/extend
superType
-
close
public void close()
-
-