Interface AnnotationFilter
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Callback interface that can be used to filter specific annotation types.
Note that the MergedAnnotations
model (which this interface has been
designed for) always ignores lang annotations according to the PLAIN
filter (for efficiency reasons). Any additional filters and even custom filter
implementations apply within this boundary and may only narrow further from here.
- Since:
- 5.2
- Author:
- Phillip Webb, Juergen Hoeller
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionstatic final AnnotationFilter
AnnotationFilter
that always matches and can be used when no relevant annotation types are expected to be present at all.static final AnnotationFilter
static final AnnotationFilter
Deprecated.static final AnnotationFilter
AnnotationFilter
that matches annotations in thejava.lang
andorg.springframework.lang
packages and their subpackages. -
Method Summary
Modifier and TypeMethodDescriptiondefault boolean
matches
(Annotation annotation) Test if the given annotation matches the filter.default boolean
Test if the given type matches the filter.boolean
Test if the given type name matches the filter.static AnnotationFilter
Create a newAnnotationFilter
that matches annotations in the specified packages.
-
Field Details
-
PLAIN
AnnotationFilter
that matches annotations in thejava.lang
andorg.springframework.lang
packages and their subpackages.This is the default filter in the
MergedAnnotations
model. -
JAVA
-
ALL
AnnotationFilter
that always matches and can be used when no relevant annotation types are expected to be present at all. -
NONE
Deprecated.as of 5.2.6 since theMergedAnnotations
model always ignores lang annotations according to thePLAIN
filter (for efficiency reasons)AnnotationFilter
that never matches and can be used when no filtering is needed (allowing for any annotation types to be present).- See Also:
-
-
Method Details
-
matches
Test if the given annotation matches the filter.- Parameters:
annotation
- the annotation to test- Returns:
true
if the annotation matches
-
matches
Test if the given type matches the filter.- Parameters:
type
- the annotation type to test- Returns:
true
if the annotation matches
-
matches
Test if the given type name matches the filter.- Parameters:
typeName
- the fully qualified class name of the annotation type to test- Returns:
true
if the annotation matches
-
packages
Create a newAnnotationFilter
that matches annotations in the specified packages.- Parameters:
packages
- the annotation packages that should match- Returns:
- a new
AnnotationFilter
instance
-
MergedAnnotations
model always ignores lang annotations according to thePLAIN
filter (for efficiency reasons)