Package org.springframework.core.type

# Class StandardAnnotationMetadata

java.lang.Object
org.springframework.core.type.StandardClassMetadata
org.springframework.core.type.StandardAnnotationMetadata

All Implemented Interfaces:
  `AnnotatedTypeMetadata`, `AnnotationMetadata`, `ClassMetadata`

public class StandardAnnotationMetadata extends StandardClassMetadata implements AnnotationMetadata
`AnnotationMetadata` implementation that uses standard reflection to introspect a given `Class`.

Since:
  2.5
Author:
  Juergen Hoeller, Mark Fisher, Chris Beams, Phillip Webb, Sam Brannen

## Constructor Summary

Constructors
Constructor
Description
`StandardAnnotationMetadata(Class<?> introspectedClass)`
Deprecated.
since 5.2 in favor of the factory method `AnnotationMetadata.introspect(Class)`
`StandardAnnotationMetadata(Class<?> introspectedClass, boolean nestedAnnotationsAsMap)`
Deprecated.
since 5.2 in favor of the factory method `AnnotationMetadata.introspect(Class)`.

## Method Summary

Modifier and Type
Method
Description
`MultiValueMap<String,Object>`
`getAllAnnotationAttributes(String annotationName, boolean classValuesAsString)`
Retrieve all attributes of all annotations of the given type, if any (i.e.
`Set<MethodMetadata>`
`getAnnotatedMethods(String annotationName)`
Retrieve the method metadata for all methods that are annotated (or meta-annotated) with the given annotation type.
`Map<String,Object>`
`getAnnotationAttributes(String annotationName, boolean classValuesAsString)`
Retrieve the attributes of the annotation of the given type, if any (i.e.
`MergedAnnotations`
`getAnnotations()`
Get annotation details based on the direct annotations and meta-annotations of the underlying element.
`Set<String>`
`getAnnotationTypes()`
Get the fully-qualified class names of all annotation types that are directly present on the underlying class.
`Set<MethodMetadata>`
`getDeclaredMethods()`
Retrieve the method metadata for all user-declared methods on the underlying class, preserving declaration order as far as possible.
`boolean`
`hasAnnotatedMethods(String annotationName)`
Determine whether the underlying class has any methods that are annotated (or meta-annotated) with the given annotation type.

### Methods inherited from class org.springframework.core.type.StandardClassMetadata

`equals, getClassName, getEnclosingClassName, getInterfaceNames, getIntrospectedClass, getMemberClassNames, getSuperClassName, hashCode, isAbstract, isAnnotation, isFinal, isIndependent, isInterface, toString`

### Methods inherited from class java.lang.Object

`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

### Methods inherited from interface org.springframework.core.type.AnnotatedTypeMetadata

`getAllAnnotationAttributes, getAnnotationAttributes, getMergedRepeatableAnnotationAttributes, getMergedRepeatableAnnotationAttributes, getMergedRepeatableAnnotationAttributes, isAnnotated`

### Methods inherited from interface org.springframework.core.type.AnnotationMetadata

`getMetaAnnotationTypes, hasAnnotation, hasMetaAnnotation`

### Methods inherited from interface org.springframework.core.type.ClassMetadata

`getClassName, getEnclosingClassName, getInterfaceNames, getMemberClassNames, getSuperClassName, hasEnclosingClass, hasSuperClass, isAbstract, isAnnotation, isConcrete, isFinal, isIndependent, isInterface`

## Constructor Details

### StandardAnnotationMetadata

@Deprecated public StandardAnnotationMetadata(Class<?> introspectedClass)
Deprecated.
since 5.2 in favor of the factory method `AnnotationMetadata.introspect(Class)`
Create a new `StandardAnnotationMetadata` wrapper for the given Class.

Parameters:
  `introspectedClass` - the Class to introspect
See Also:
  - `StandardAnnotationMetadata(Class, boolean)`

### StandardAnnotationMetadata

@Deprecated public StandardAnnotationMetadata(Class<?> introspectedClass, boolean nestedAnnotationsAsMap)
Deprecated.
since 5.2 in favor of the factory method `AnnotationMetadata.introspect(Class)`. Use `MergedAnnotation.asMap` from `getAnnotations()` rather than `AnnotatedTypeMetadata.getAnnotationAttributes(String)` if `nestedAnnotationsAsMap` is `false`
Create a new `StandardAnnotationMetadata` wrapper for the given Class, providing the option to return any nested annotations or annotation arrays in the form of `AnnotationAttributes` instead of actual `Annotation` instances.

Parameters:
  `introspectedClass` - the Class to introspect
  `nestedAnnotationsAsMap` - return nested annotations and annotation arrays as `AnnotationAttributes` for compatibility with ASM-based `AnnotationMetadata` implementations
Since:
  3.1.1

## Method Details

### getAnnotations

public MergedAnnotations getAnnotations()
Description copied from interface: `AnnotatedTypeMetadata`
Get annotation details based on the direct annotations and meta-annotations of the underlying element.

Specified by:
  `getAnnotations` in interface `AnnotatedTypeMetadata`
Returns:
  merged annotations based on the direct annotations and meta-annotations

### getAnnotationTypes

public Set<String> getAnnotationTypes()
Description copied from interface: `AnnotationMetadata`
Get the fully-qualified class names of all annotation types that are directly present on the underlying class.

Specified by:
  `getAnnotationTypes` in interface `AnnotationMetadata`
Returns:
  the annotation type names

### getAnnotationAttributes

@Nullable public Map<String,Object> getAnnotationAttributes(String annotationName, boolean classValuesAsString)
Description copied from interface: `AnnotatedTypeMetadata`
Retrieve the attributes of the annotation of the given type, if any (i.e. if defined on the underlying element, as direct annotation or meta-annotation).

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

Specified by:
  `getAnnotationAttributes` in interface `AnnotatedTypeMetadata`
Parameters:
  `annotationName` - the fully-qualified class name of the annotation type to look for
  `classValuesAsString` - whether to convert class references to String class names for exposure as values in the returned Map, instead of Class references which might potentially have to be loaded first
Returns:
  a `Map` of attributes, with each annotation attribute name as map key (for example, "location") and the attribute's value as map value; or `null` if no matching annotation is found

### getAllAnnotationAttributes

@Nullable public MultiValueMap<String,Object> getAllAnnotationAttributes(String annotationName, boolean classValuesAsString)
Description copied from interface: `AnnotatedTypeMetadata`
Retrieve all attributes of all annotations of the given type, if any (i.e. if defined on the underlying element, as direct annotation or meta-annotation).

Note: this method does not take attribute overrides on composed annotations into account.

Specified by:
  `getAllAnnotationAttributes` in interface `AnnotatedTypeMetadata`
Parameters:
  `annotationName` - the fully-qualified class name of the annotation type to look for
  `classValuesAsString` - whether to convert class references to String class names for exposure as values in the returned Map, instead of Class references which might potentially have to be loaded first
Returns:
  a `MultiValueMap` of attributes, with each annotation attribute name as map key (for example, "location") and a list of the attribute's values as map value; or `null` if no matching annotation is found
See Also:
  - `AnnotatedTypeMetadata.getAllAnnotationAttributes(String)`

### hasAnnotatedMethods

public boolean hasAnnotatedMethods(String annotationName)
Description copied from interface: `AnnotationMetadata`
Determine whether the underlying class has any methods that are annotated (or meta-annotated) with the given annotation type.

Specified by:
  `hasAnnotatedMethods` in interface `AnnotationMetadata`
Parameters:
  `annotationName` - the fully-qualified class name of the annotation type to look for

### getAnnotatedMethods

public Set<MethodMetadata> getAnnotatedMethods(String annotationName)
Description copied from interface: `AnnotationMetadata`
Retrieve the method metadata for all methods that are annotated (or meta-annotated) with the given annotation type.

For any returned method, `AnnotatedTypeMetadata.isAnnotated(java.lang.String)` will return `true` for the given annotation type.

Specified by:
  `getAnnotatedMethods` in interface `AnnotationMetadata`
Parameters:
  `annotationName` - the fully-qualified class name of the annotation type to look for
Returns:
  a set of `MethodMetadata` for methods that have a matching annotation. The return value will be an empty set if no methods match the annotation type.

### getDeclaredMethods

public Set<MethodMetadata> getDeclaredMethods()
Description copied from interface: `AnnotationMetadata`
Retrieve the method metadata for all user-declared methods on the underlying class, preserving declaration order as far as possible.

Specified by:
  `getDeclaredMethods` in interface `AnnotationMetadata`
Returns:
  a set of `MethodMetadata`