Class AnnotatedClassFinder
java.lang.Object
org.springframework.boot.test.context.AnnotatedClassFinder
Utility class to find a class annotated with a particular annotation in a hierarchy.
- Since:
- 2.1.0
- Author:
- Phillip Webb, Artsiom Yudovin, Stephane Nicoll
-
Constructor Summary
ConstructorsConstructorDescriptionAnnotatedClassFinder(Class<? extends Annotation> annotationType) Create a new instance with theannotationTypeto find. -
Method Summary
Modifier and TypeMethodDescriptionClass<?>findFromClass(Class<?> source) Find the firstClassthat is annotated with the target annotation, starting from the package defined by the givensourceup to the root.Class<?>findFromPackage(String source) Find the firstClassthat is annotated with the target annotation, starting from the package defined by the givensourceup to the root.
-
Constructor Details
-
AnnotatedClassFinder
Create a new instance with theannotationTypeto find.- Parameters:
annotationType- the annotation to find
-
-
Method Details
-
findFromClass
Find the firstClassthat is annotated with the target annotation, starting from the package defined by the givensourceup to the root.- Parameters:
source- the source class to use to initiate the search- Returns:
- the first
Classannotated with the target annotation within the hierarchy defined by the givensourceornullif none is found.
-
findFromPackage
Find the firstClassthat is annotated with the target annotation, starting from the package defined by the givensourceup to the root.- Parameters:
source- the source package to use to initiate the search- Returns:
- the first
Classannotated with the target annotation within the hierarchy defined by the givensourceornullif none is found.
-