接口 AnnotationFilter
- 函数接口:
- 这是一个函数接口, 因此可用作 lambda 表达式或方法引用的赋值目标。
@FunctionalInterface public interface AnnotationFilter
Callback interface that can be used to filter specific annotation types.Note that the
MergedAnnotationsmodel (which this interface has been designed for) always ignores lang annotations according to thePLAINfilter (for efficiency reasons). Any additional filters and even custom filter implementations apply within this boundary and may only narrow further from here.- 从以下版本开始:
- 5.2
- 作者:
- Phillip Webb, Juergen Hoeller
- 另请参阅:
MergedAnnotations
字段概要
字段 修饰符和类型 字段 说明 static AnnotationFilterALLAnnotationFilterthat always matches and can be used when no relevant annotation types are expected to be present at all.static AnnotationFilterJAVAstatic AnnotationFilterNONE已过时。as of 5.2.6 since theMergedAnnotationsmodel always ignores lang annotations according to thePLAINfilter (for efficiency reasons)static AnnotationFilterPLAINAnnotationFilterthat matches annotations in thejava.langandorg.springframework.langpackages and their subpackages.
方法概要
所有方法 静态方法 实例方法 抽象方法 默认方法 修饰符和类型 方法 说明 default booleanmatches(Annotation annotation)Test if the given annotation matches the filter.default booleanmatches(Class<?> type)Test if the given type matches the filter.booleanmatches(String typeName)Test if the given type name matches the filter.static AnnotationFilterpackages(String... packages)Create a newAnnotationFilterthat matches annotations in the specified packages.
字段详细资料
PLAIN
static final AnnotationFilter PLAIN
AnnotationFilterthat matches annotations in thejava.langandorg.springframework.langpackages and their subpackages.This is the default filter in the
MergedAnnotationsmodel.
JAVA
static final AnnotationFilter JAVA
ALL
static final AnnotationFilter ALL
AnnotationFilterthat always matches and can be used when no relevant annotation types are expected to be present at all.
NONE
@Deprecated static final AnnotationFilter NONE
已过时。as of 5.2.6 since theMergedAnnotationsmodel always ignores lang annotations according to thePLAINfilter (for efficiency reasons)AnnotationFilterthat never matches and can be used when no filtering is needed (allowing for any annotation types to be present).- 另请参阅:
PLAIN
方法详细资料
matches
default boolean matches(Annotation annotation)
Test if the given annotation matches the filter.- 参数:
annotation- the annotation to test- 返回:
trueif the annotation matches
matches
default boolean matches(Class<?> type)
Test if the given type matches the filter.- 参数:
type- the annotation type to test- 返回:
trueif the annotation matches
matches
boolean matches(String typeName)
Test if the given type name matches the filter.- 参数:
typeName- the fully qualified class name of the annotation type to test- 返回:
trueif the annotation matches
packages
static AnnotationFilter packages(String... packages)
Create a newAnnotationFilterthat matches annotations in the specified packages.- 参数:
packages- the annotation packages that should match- 返回:
- a new
AnnotationFilterinstance