Class ClassFinder.DefaultClassFinder
java.lang.Object
com.vaadin.flow.server.frontend.scanner.ClassFinder.DefaultClassFinder
- All Implemented Interfaces:
ClassFinder,Serializable
- Enclosing interface:
ClassFinder
Implementation that searches for annotated classes or subclasses in a
list of classes.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.vaadin.flow.server.frontend.scanner.ClassFinder
ClassFinder.CachedClassFinder, ClassFinder.DefaultClassFinder -
Constructor Summary
ConstructorsConstructorDescriptionDefaultClassFinder(ClassLoader classLoader, Class<?>... classes) ClassFinder using a specifiedClassLoaderto load classes and a list of classes where to look for annotations or subclasses.DefaultClassFinder(Set<Class<?>> classes) It uses current classloader for getting resources or loading classes. -
Method Summary
Modifier and TypeMethodDescriptiongetAnnotatedClasses(Class<? extends Annotation> annotation) 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.<T> Class<T> Load a class in the classloader.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.vaadin.flow.server.frontend.scanner.ClassFinder
getAnnotatedClasses, getSubTypesOf, shouldInspectClass
-
Constructor Details
-
DefaultClassFinder
It uses current classloader for getting resources or loading classes.- Parameters:
classes- The classes.
-
DefaultClassFinder
ClassFinder using a specifiedClassLoaderto load classes and a list of classes where to look for annotations or subclasses.- Parameters:
classLoader- classloader for getting resources or loading classes.classes- classes where to look for annotations or subclasses.
-
-
Method Details
-
getAnnotatedClasses
Description copied from interface:ClassFinderGet annotated classes in the classloader.- Specified by:
getAnnotatedClassesin interfaceClassFinder- Parameters:
annotation- the annotation- Returns:
- a set with all classes that are annotated
-
getResource
Description copied from interface:ClassFinderGet a resource from the classpath.- Specified by:
getResourcein interfaceClassFinder- Parameters:
name- class literal- Returns:
- the resource
-
loadClass
Description copied from interface:ClassFinderLoad a class in the classloader.- Specified by:
loadClassin interfaceClassFinder- Type Parameters:
T- the type of the class- Parameters:
name- the class literal- Returns:
- the class
- Throws:
ClassNotFoundException- when the class is not in the classpath
-
getSubTypesOf
Description copied from interface:ClassFinderGets all subtypes in hierarchy of a given type.- Specified by:
getSubTypesOfin interfaceClassFinder- 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
Description copied from interface:ClassFinderGet class loader which is used to find classes.- Specified by:
getClassLoaderin interfaceClassFinder- Returns:
- the class loader which is used to find classes..
-