@FunctionalInterface public interface AnnotationFilter
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.
MergedAnnotations
Modifier and Type | Field and Description |
---|---|
static AnnotationFilter |
ALL
AnnotationFilter that always matches and can be used when no
relevant annotation types are expected to be present at all. |
static AnnotationFilter |
JAVA
|
static AnnotationFilter |
NONE
Deprecated.
as of 5.2.6 since the
MergedAnnotations model
always ignores lang annotations according to the PLAIN filter
(for efficiency reasons) |
static AnnotationFilter |
PLAIN
AnnotationFilter that matches annotations in the
java.lang and org.springframework.lang packages
and their subpackages. |
Modifier and Type | Method and Description |
---|---|
default boolean |
matches(Annotation annotation)
Test if the given annotation matches the filter.
|
default boolean |
matches(Class<?> type)
Test if the given type matches the filter.
|
boolean |
matches(String typeName)
Test if the given type name matches the filter.
|
static AnnotationFilter |
packages(String... packages)
Create a new
AnnotationFilter that matches annotations in the
specified packages. |
static final AnnotationFilter PLAIN
AnnotationFilter
that matches annotations in the
java.lang
and org.springframework.lang
packages
and their subpackages.
This is the default filter in the MergedAnnotations
model.
static final AnnotationFilter JAVA
static final AnnotationFilter ALL
AnnotationFilter
that always matches and can be used when no
relevant annotation types are expected to be present at all.@Deprecated static final AnnotationFilter NONE
MergedAnnotations
model
always ignores lang annotations according to the PLAIN
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).PLAIN
default boolean matches(Annotation annotation)
annotation
- the annotation to testtrue
if the annotation matchesdefault boolean matches(Class<?> type)
type
- the annotation type to testtrue
if the annotation matchesboolean matches(String typeName)
typeName
- the fully qualified class name of the annotation type to testtrue
if the annotation matchesstatic AnnotationFilter packages(String... packages)
AnnotationFilter
that matches annotations in the
specified packages.packages
- the annotation packages that should matchAnnotationFilter
instance