public abstract class MergedAnnotationPredicates
extends java.lang.Object
MergedAnnotations
.Modifier and Type | Class and Description |
---|---|
private static class |
MergedAnnotationPredicates.FirstRunOfPredicate<A extends java.lang.annotation.Annotation>
Predicate implementation used for
firstRunOf(Function) . |
private static class |
MergedAnnotationPredicates.UniquePredicate<A extends java.lang.annotation.Annotation,K>
Predicate implementation used for
unique(Function) . |
Modifier | Constructor and Description |
---|---|
private |
MergedAnnotationPredicates() |
Modifier and Type | Method and Description |
---|---|
static <A extends java.lang.annotation.Annotation> |
firstRunOf(java.util.function.Function<? super MergedAnnotation<A>,?> valueExtractor)
Create a new stateful, single use
Predicate that matches only
the first run of an extracted value. |
static <A extends java.lang.annotation.Annotation> |
typeIn(java.lang.Class<?>... types)
Create a new
Predicate that evaluates to true if the
merged annotation type is contained in
the specified array. |
static <A extends java.lang.annotation.Annotation> |
typeIn(java.util.Collection<?> types)
Create a new
Predicate that evaluates to true if the
merged annotation type is contained in
the collection. |
static <A extends java.lang.annotation.Annotation> |
typeIn(java.lang.String... typeNames)
Create a new
Predicate that evaluates to true if the
merged annotation type is contained in
the specified array. |
static <A extends java.lang.annotation.Annotation,K> |
unique(java.util.function.Function<? super MergedAnnotation<A>,K> keyExtractor)
Create a new stateful, single use
Predicate that matches
annotations that are unique based on the extracted key. |
public static <A extends java.lang.annotation.Annotation> java.util.function.Predicate<MergedAnnotation<? extends A>> typeIn(java.lang.String... typeNames)
Predicate
that evaluates to true
if the
merged annotation type is contained in
the specified array.A
- the annotation typetypeNames
- the names that should be matchedPredicate
to test the annotation typepublic static <A extends java.lang.annotation.Annotation> java.util.function.Predicate<MergedAnnotation<? extends A>> typeIn(java.lang.Class<?>... types)
Predicate
that evaluates to true
if the
merged annotation type is contained in
the specified array.A
- the annotation typetypes
- the types that should be matchedPredicate
to test the annotation typepublic static <A extends java.lang.annotation.Annotation> java.util.function.Predicate<MergedAnnotation<? extends A>> typeIn(java.util.Collection<?> types)
Predicate
that evaluates to true
if the
merged annotation type is contained in
the collection.A
- the annotation typetypes
- the type names or classes that should be matchedPredicate
to test the annotation typepublic static <A extends java.lang.annotation.Annotation> java.util.function.Predicate<MergedAnnotation<A>> firstRunOf(java.util.function.Function<? super MergedAnnotation<A>,?> valueExtractor)
Predicate
that matches only
the first run of an extracted value. For example,
MergedAnnotationPredicates.firstRunOf(MergedAnnotation::depth)
will return the first annotation and a subsequent run of the same depth.
NOTE: This predicate only matches the first first run. Once the extracted
value changes, the predicate always returns false
.
valueExtractor
- function used to extract the value to checkPredicate
that matches the first run of the extracted
valuespublic static <A extends java.lang.annotation.Annotation,K> java.util.function.Predicate<MergedAnnotation<A>> unique(java.util.function.Function<? super MergedAnnotation<A>,K> keyExtractor)
Predicate
that matches
annotations that are unique based on the extracted key. For example
MergedAnnotationPredicates.unique(MergedAnnotation::type)
will
match the first time a unique type is encountered.keyExtractor
- function used to extract the key used to test for
uniquenessPredicate
that matches a unique annotation based on the
extracted key