类 AnnotatedClassFinder
- java.lang.Object
- org.springframework.boot.test.context.AnnotatedClassFinder
public final class AnnotatedClassFinder extends Object
Utility class to find a class annotated with a particular annotation in a hierarchy.- 从以下版本开始:
- 2.1.0
构造器概要
构造器 构造器 说明 AnnotatedClassFinder(Class<? extends Annotation> annotationType)
Create a new instance with theannotationType
to find.
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 Class<?>
findFromClass(Class<?> source)
Find the firstClass
that is annotated with the target annotation, starting from the package defined by the givensource
up to the root.Class<?>
findFromPackage(String source)
Find the firstClass
that is annotated with the target annotation, starting from the package defined by the givensource
up to the root.
构造器详细资料
AnnotatedClassFinder
public AnnotatedClassFinder(Class<? extends Annotation> annotationType)
Create a new instance with theannotationType
to find.- 参数:
annotationType
- the annotation to find
方法详细资料
findFromClass
public Class<?> findFromClass(Class<?> source)
Find the firstClass
that is annotated with the target annotation, starting from the package defined by the givensource
up to the root.- 参数:
source
- the source class to use to initiate the search- 返回:
- the first
Class
annotated with the target annotation within the hierarchy defined by the givensource
ornull
if none is found.
findFromPackage
public Class<?> findFromPackage(String source)
Find the firstClass
that is annotated with the target annotation, starting from the package defined by the givensource
up to the root.- 参数:
source
- the source package to use to initiate the search- 返回:
- the first
Class
annotated with the target annotation within the hierarchy defined by the givensource
ornull
if none is found.