Interface ClassFinder
- All Superinterfaces:
Serializable
- All Known Implementing Classes:
ClassFinder.CachedClassFinder
,ClassFinder.DefaultClassFinder
Interface for annotated and subclass class searches.
For internal use only. May be renamed or removed in a future release.
- Since:
- 2.0
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic class
Implementation that proxy and cache a realClassFinder
.static class
Implementation that searches for annotated classes or subclasses in a list of classes. -
Method Summary
Modifier and TypeMethodDescriptiongetAnnotatedClasses
(Class<? extends Annotation> clazz) Get annotated classes in the classloader.getAnnotatedClasses
(String className) Get annotated classes in the classloader.Get class loader which is used to find classes.getResource
(String name) Get a resource from the classpath.getSubTypesOf
(Class<T> type) Gets all subtypes in hierarchy of a given type.getSubTypesOf
(String name) Gets all subtypes in hierarchy of a given type, using FQN string.<T> Class<T>
Load a class in the classloader.
-
Method Details
-
getAnnotatedClasses
Get annotated classes in the classloader.- Parameters:
clazz
- the annotation- Returns:
- a set with all classes that are annotated
-
getAnnotatedClasses
Get annotated classes in the classloader.- Parameters:
className
- the annotation class name- Returns:
- a set with all classes that are annotated
- Throws:
ClassNotFoundException
- when the class not found
-
getResource
Get a resource from the classpath.- Parameters:
name
- class literal- Returns:
- the resource
-
loadClass
Load a class in the classloader.- Parameters:
name
- the class literal- Returns:
- the class
- Throws:
ClassNotFoundException
- when the class is not in the classpath
-
getSubTypesOf
Gets all subtypes in hierarchy of a given type.- Type Parameters:
T
- the class of the type- Parameters:
type
- the type to search for the subtypes for- Returns:
- set of the subtypes of the given class
-
getClassLoader
ClassLoader getClassLoader()Get class loader which is used to find classes.- Returns:
- the class loader which is used to find classes..
-
getSubTypesOf
Gets all subtypes in hierarchy of a given type, using FQN string.- Type Parameters:
T
- the class of the type- Parameters:
name
- Fully qualified name of the type to search subtypes of- Returns:
- set of the subtypes of the given class
- Throws:
ClassNotFoundException
- when the parent class is not in the classpath
-