public final class AnnotationUtils
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static <A extends java.lang.annotation.Annotation> |
findRepeatableAnnotations(java.lang.reflect.AnnotatedElement element,
java.lang.Class<A> annotationType)
Find all repeatable annotations of
annotationType that are either present, indirectly
present, or meta-present on the supplied AnnotatedElement . |
public static <A extends java.lang.annotation.Annotation> java.util.List<A> findRepeatableAnnotations(java.lang.reflect.AnnotatedElement element, java.lang.Class<A> annotationType)
annotationType
that are either present, indirectly
present, or meta-present on the supplied AnnotatedElement
.
This method extends the functionality of
AnnotatedElement.getAnnotationsByType(Class)
with additional support for meta-annotations.
In addition, if the element is a class and the repeatable annotation
is @Inherited
, this method will
search on superclasses first in order to support top-down semantics.
The result is that this algorithm finds repeatable annotations that
would be shadowed and therefore not visible according to Java's
standard semantics for inherited, repeatable annotations.
If the element is a class and the repeatable annotation is not discovered within the class hierarchy, this method will additionally search on interfaces implemented by each class in the hierarchy.
If the supplied element
is null
, this method simply
returns an empty list.
A
- the annotation instanceelement
- the element to search on, potentially null
annotationType
- the repeatable annotation type to search for; never null
null
nor mutableRepeatable
,
Inherited