AnnotatedElements.
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.
Support 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 inherited) or declared
within the annotation hierarchy above the AnnotatedElement.
Find semantics are much more exhaustive, providing get semantics plus support for the following:
@InheritedMethods following get semantics will honor the contract of Java's
@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 a need for @Inherited.
AliasFor, AnnotationAttributes, AnnotationUtils, BridgeMethodResolver
| Modifier and Type | Class and Description |
|---|---|
| private static class | AnnotatedElementUtils.AnnotatedElementForAnnotations
Adapted |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public static <A extends Annotation> Set | Returns: the set of all merged, synthesizedAnnotations found,
or an empty set if none were foundthe annotated element (never element, Class<A> null)the annotation type to find (never annotationType)null)Find all annotations of the specified |
| public static Set | Returns: the set of all merged, synthesizedAnnotations found,
or an empty set if none were foundthe annotated element (never element, Set<Class<? extends Annotation>> null)the annotation types to find annotationTypes)Find all annotations of the specified |
| private static MergedAnnotations | |
| public static <A extends Annotation> A | Returns: the merged, synthesizedAnnotation, or null if not foundthe annotated element element, Class<A> the annotation type to find annotationType)Find the first annotation of the specified |
| public static AnnotationAttributes | Returns: the mergedAnnotationAttributes, or null if not foundthe annotated element element, Class<? extends Annotation> the annotation type to find annotationType, boolean whether to convert Class references into
Strings or to preserve them as Class references classValuesAsString, boolean whether to convert nested Annotation instances into
nestedAnnotationsAsMap)AnnotationAttributes maps or to preserve them as Annotation instancesFind the first annotation of the specified |
| public static AnnotationAttributes | Returns: the mergedAnnotationAttributes, or null if not foundthe annotated element element, String the fully qualified class name of the annotation type to find annotationName, boolean whether to convert Class references into Strings or to
preserve them as Class references classValuesAsString, boolean whether to convert nested Annotation instances into
nestedAnnotationsAsMap)AnnotationAttributes maps or to preserve them as Annotation instancesFind the first annotation of the specified |
| public static <A extends Annotation> Set | Returns: the set of all merged repeatableAnnotations found,
or an empty set if none were foundthe annotated element (never element, Class<A> null)the annotation type to find (never annotationType)null)Find all repeatable annotations of the specified |
| public static <A extends Annotation> Set | Returns: the set of all merged repeatableAnnotations found,
or an empty set if none were foundthe annotated element (never element, Class<A> null)the annotation type to find (never annotationType, Class<? extends Annotation> null)the type of the container that holds the annotations;
may be containerType)null if the container type should be looked up via
java.Find all repeatable annotations of the specified |
| private static MergedAnnotations | findRepeatableAnnotations(AnnotatedElement element, Class<? extends Annotation> containerType, Class<? extends Annotation> annotationType)
|
| public static AnnotatedElement | forAnnotations(Annotation...
the annotations to expose through the annotations)AnnotatedElementBuild an adapted |
| public static MultiValueMap | Returns: aMultiValueMap keyed by attribute name, containing the annotation
attributes from all annotations found, or null if not foundthe annotated element element, String the fully qualified class name of the annotation type to find annotationName)Get the annotation attributes of all annotations of the specified
|
| public static MultiValueMap | Returns: aMultiValueMap keyed by attribute name, containing the annotation
attributes from all annotations found, or null if not foundthe annotated element element, String the fully qualified class name of the annotation type to find annotationName, final boolean whether to convert Class references into Strings or to
preserve them as Class references classValuesAsString, final boolean whether to convert nested Annotation instances into
nestedAnnotationsAsMap)AnnotationAttributes maps or to preserve them as Annotation instancesGet the annotation attributes of all annotations of
the specified |
| public static <A extends Annotation> Set | Returns: the set of all merged, synthesizedAnnotations found,
or an empty set if none were foundthe annotated element (never element, Class<A> null)the annotation type to find (never annotationType)null)Get all annotations of the specified |
| public static Set | Returns: the set of all merged, synthesizedAnnotations found,
or an empty set if none were foundthe annotated element (never element, Set<Class<? extends Annotation>> null)the annotation types to find annotationTypes)Get all annotations of the specified |
| private static AnnotationAttributes | getAnnotationAttributes(MergedAnnotation<?> annotation, boolean classValuesAsString, boolean nestedAnnotationsAsMap)
|
| private static MergedAnnotations | |
| public static <A extends Annotation> A | Returns: the merged, synthesizedAnnotation, or null if not foundthe annotated element element, Class<A> the annotation type to find annotationType)Get the first annotation of the specified |
| public static AnnotationAttributes | Returns: the mergedAnnotationAttributes, or null if not foundthe annotated element element, Class<? extends Annotation> the annotation type to find annotationType)Get the first annotation of the specified |
| public static AnnotationAttributes | Returns: the mergedAnnotationAttributes, or null if not foundthe annotated element element, String the fully qualified class name of the annotation type to find annotationName)Get the first annotation of the specified |
| public static AnnotationAttributes | Returns: the mergedAnnotationAttributes, or null if not foundthe annotated element element, String the fully qualified class name of the annotation type to find annotationName, boolean whether to convert Class references into Strings or to
preserve them as Class references classValuesAsString, boolean whether to convert nested Annotation instances
into nestedAnnotationsAsMap)AnnotationAttributes maps or to preserve them as Annotation instancesGet the first annotation of the specified |
| public static <A extends Annotation> Set | Returns: the set of all merged repeatableAnnotations found,
or an empty set if none were foundthe annotated element (never element, Class<A> null)the annotation type to find (never annotationType)null)Get all repeatable annotations of the specified |
| public static <A extends Annotation> Set | Returns: the set of all merged repeatableAnnotations found,
or an empty set if none were foundthe annotated element (never element, Class<A> null)the annotation type to find (never annotationType, Class<? extends Annotation> null)the type of the container that holds the annotations;
may be containerType)null if the container type should be looked up via
java.Get all repeatable annotations of the specified |
| public static Set | Returns: the names of all meta-annotations present on the annotation, or an empty set if not foundthe annotated element element, Class<? extends Annotation> the annotation type on which to find meta-annotations annotationType)Get the fully qualified class names of all meta-annotation types
present on the annotation (of the specified |
| public static Set | Returns: the names of all meta-annotations present on the annotation, or an empty set if none foundthe annotated element element, String the fully qualified class name of the annotation
type on which to find meta-annotations annotationName)Get the fully qualified class names of all meta-annotation
types present on the annotation (of the specified
|
| private static Set | |
| private static MergedAnnotations | getRepeatableAnnotations(AnnotatedElement element, Class<? extends Annotation> containerType, Class<? extends Annotation> annotationType)
|
| public static boolean | Returns: true if a matching annotation is presentthe annotated element element, Class<? extends Annotation> the annotation type to find annotationType)Determine if an annotation of the specified |
| public static boolean | Returns: true if a matching meta-annotation is presentthe annotated element element, Class<? extends Annotation> the meta-annotation type to find annotationType)Determine if the supplied |
| public static boolean | Returns: true if a matching meta-annotation is presentthe annotated element element, String the fully qualified class name of the
meta-annotation type to find annotationName)Determine if the supplied |
| private static <A extends Annotation> Comparator | |
| public static boolean | Returns: true if a matching annotation is presentthe annotated element element, Class<? extends Annotation> the annotation type to find annotationType)Determine if an annotation of the specified |
| public static boolean | Returns: true if a matching annotation is presentthe annotated element element, String the fully qualified class name of the annotation type to find annotationName)Determine if an annotation of the specified |
| private static MultiValueMap |