spring-framework / org.springframework.core.annotation / AnnotatedElementUtils / findMergedRepeatableAnnotations

findMergedRepeatableAnnotations

open static fun <A : Annotation> findMergedRepeatableAnnotations(element: AnnotatedElement, annotationType: Class<A>): MutableSet<A>

Find all repeatable annotations of the specified annotationType within the annotation hierarchy above the supplied element; and for each annotation found, merge that annotation's attributes with matching attributes from annotations in lower levels of the annotation hierarchy and synthesize the results back into an annotation of the specified annotationType.

The container type that holds the repeatable annotations will be looked up via java.lang.annotation.Repeatable.

AliasFor semantics are fully supported, both within a single annotation and within annotation hierarchies.

This method follows find semantics as described in the AnnotatedElementUtils.

Parameters

element - the annotated element (never null)

annotationType - the annotation type to find (never null)

Exceptions

IllegalArgumentException - if the element or annotationType is null, or if the container type cannot be resolved

Return
the set of all merged repeatable Annotations found, or an empty set if none were found

Since
4.3

See Also
#findMergedAnnotation(AnnotatedElement, Class)#findAllMergedAnnotations(AnnotatedElement, Class)#findMergedRepeatableAnnotations(AnnotatedElement, Class, Class)

open static fun <A : Annotation> findMergedRepeatableAnnotations(element: AnnotatedElement, annotationType: Class<A>, @Nullable containerType: Class<out Annotation>): MutableSet<A>

Find all repeatable annotations of the specified annotationType within the annotation hierarchy above the supplied element; and for each annotation found, merge that annotation's attributes with matching attributes from annotations in lower levels of the annotation hierarchy and synthesize the results back into an annotation of the specified annotationType.

AliasFor semantics are fully supported, both within a single annotation and within annotation hierarchies.

This method follows find semantics as described in the AnnotatedElementUtils.

Parameters

element - the annotated element (never null)

annotationType - the annotation type to find (never null)

containerType - the type of the container that holds the annotations; may be null if the container type should be looked up via java.lang.annotation.Repeatable

Exceptions

IllegalArgumentException - if the element or annotationType is null, or if the container type cannot be resolved

AnnotationConfigurationException - if the supplied containerType is not a valid container annotation for the supplied annotationType

Return
the set of all merged repeatable Annotations found, or an empty set if none were found

Since
4.3

See Also
#findMergedAnnotation(AnnotatedElement, Class)#findAllMergedAnnotations(AnnotatedElement, Class)