Interface AnnotationFilter
-
- All Known Subinterfaces:
AnnotationFilter.Singular<A>
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface public interface AnnotationFilter
Predicate-like interface for annotations onAnnotatedElement
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
AnnotationFilter.Singular<A extends Annotation>
Concretization of filters that only match when there's a specified annotation present on element.
-
Field Summary
Fields Modifier and Type Field Description static AnnotationFilter
ABSENT
Filter that matches onlyelements
that doesnt have annotations.static AnnotationFilter
ACCEPTING
Filter that matches anyelement
.static AnnotationFilter
REJECTING
Filter that doesn't match anyelement
.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default AnnotationFilter
and(AnnotationFilter other)
Creates conjunction between this and provided filter.boolean
matches(AnnotatedElement element)
Function method that checks element.default AnnotationFilter
negated()
Creates filter negation.default AnnotationFilter
or(AnnotationFilter other)
Creates disjunction between this and provided filter.static <A extends Annotation>
AnnotationFilter.Singular<A>single(Class<A> annotationClass)
Returns filter that requires specified annotation by type to be present on element to match.
-
-
-
Field Detail
-
ACCEPTING
static final AnnotationFilter ACCEPTING
Filter that matches anyelement
.
-
REJECTING
static final AnnotationFilter REJECTING
Filter that doesn't match anyelement
.
-
ABSENT
static final AnnotationFilter ABSENT
Filter that matches onlyelements
that doesnt have annotations.
-
-
Method Detail
-
single
static <A extends Annotation> AnnotationFilter.Singular<A> single(Class<A> annotationClass)
Returns filter that requires specified annotation by type to be present on element to match.Further filtering can be done with
AnnotationFilter.Singular.andMatching(java.util.function.Predicate<? super A>)
.- Type Parameters:
A
- annotation type- Parameters:
annotationClass
- type of annotation to look for- Returns:
- filter for single annotation of speciefied type
-
matches
boolean matches(AnnotatedElement element)
Function method that checks element.- Parameters:
element
- element to test- Returns:
- if element matches filter
-
and
default AnnotationFilter and(AnnotationFilter other)
Creates conjunction between this and provided filter.- Parameters:
other
- additional filter to be checked- Returns:
- filter that matches only when this and other filter matches
-
or
default AnnotationFilter or(AnnotationFilter other)
Creates disjunction between this and provided filter.- Parameters:
other
- additional filter to be checked- Returns:
- filter that matches whenever this or other filter matches
-
negated
default AnnotationFilter negated()
Creates filter negation.- Returns:
- filter that matches only when this filter doesn't
-
-