AnnotatedElementUtils()
General utility methods for finding annotations, meta-annotations, and repeatable annotations on AnnotatedElement.
AnnotatedElementUtils defines the public API for Spring's meta-annotation programming model with support for annotation attribute overrides. If you do not need support for annotation attribute overrides, consider using AnnotationUtils instead.
Note that the features of this class are not provided by the JDK's introspection facilities themselves.
Annotation Attribute OverridesSupport for meta-annotations with attribute overrides in composed annotations is provided by all variants of the getMergedAnnotationAttributes(), getMergedAnnotation(), getAllMergedAnnotations(), getMergedRepeatableAnnotations(), findMergedAnnotationAttributes(), findMergedAnnotation(), findAllMergedAnnotations(), and findMergedRepeatableAnnotations() methods.
The search algorithms used by methods in this class follow either find or get semantics. Consult the javadocs for each individual method for details on which search algorithm is used.
Get semantics are limited to searching for annotations that are either present on an AnnotatedElement (i.e., declared locally or java.lang.annotation.Inherited) or declared within the annotation hierarchy above the AnnotatedElement.
Find semantics are much more exhaustive, providing get semantics plus support for the following:
@Inherited
Methods following get semantics will honor the contract of Java's java.lang.annotation.Inherited annotation except that locally declared annotations (including custom composed annotations) will be favored over inherited annotations. In contrast, methods following find semantics will completely ignore the presence of @Inherited since the find search algorithm manually traverses type and method hierarchies and thereby implicitly supports annotation inheritance without the need for @Inherited.
Author
Phillip Webb
Author
Juergen Hoeller
Author
Sam Brannen
Since
4.0
See Also
AliasForAnnotationAttributesAnnotationUtilsBridgeMethodResolver