Overview | Package | Class | Tree | Deprecated | Index | Help
| Spring Framework
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.springframework.core.type
Class StandardAnnotationMetadata

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

All Implemented Interfaces:
  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

Constructor Summary
`StandardAnnotationMetadata(java.lang.Class<?> introspectedClass)` Create a new `StandardAnnotationMetadata` wrapper for the given Class.
`StandardAnnotationMetadata(java.lang.Class<?> introspectedClass, boolean nestedAnnotationsAsMap)` 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.

Method Summary
`java.util.Set<MethodMetadata>` | `getAnnotatedMethods(java.lang.String annotationType)` Retrieve the method metadata for all methods that are annotated (or meta-annotated) with the given annotation type.
`java.util.Map<java.lang.String,java.lang.Object>` | `getAnnotationAttributes(java.lang.String annotationType)` Retrieve the attributes of the annotation of the given type, if any (i.e.
`java.util.Map<java.lang.String,java.lang.Object>` | `getAnnotationAttributes(java.lang.String annotationType, boolean classValuesAsString)` Retrieve the attributes of the annotation of the given type, if any (i.e.
`java.util.Set<java.lang.String>` | `getAnnotationTypes()` Return the names of all annotation types defined on the underlying class.
`java.util.Set<java.lang.String>` | `getMetaAnnotationTypes(java.lang.String annotationType)` Return the names of all meta-annotation types defined on the given annotation type of the underlying class.
`boolean` | `hasAnnotatedMethods(java.lang.String annotationType)` Determine whether the underlying class has any methods that are annotated (or meta-annotated) with the given annotation type.
`boolean` | `hasAnnotation(java.lang.String annotationType)` Determine whether the underlying class has an annotation of the given type defined.
`boolean` | `hasMetaAnnotation(java.lang.String annotationType)` Determine whether the underlying class has an annotation that is itself annotated with the meta-annotation of the given type.
`boolean` | `isAnnotated(java.lang.String annotationType)` Determine whether the underlying class has an annotation or meta-annotation of the given type defined.

Methods inherited from class org.springframework.core.type.StandardClassMetadata
`getClassName, getEnclosingClassName, getInterfaceNames, getIntrospectedClass, getMemberClassNames, getSuperClassName, hasEnclosingClass, hasSuperClass, isAbstract, isConcrete, isFinal, isIndependent, isInterface`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Methods inherited from interface org.springframework.core.type.ClassMetadata
`getClassName, getEnclosingClassName, getInterfaceNames, getMemberClassNames, getSuperClassName, hasEnclosingClass, hasSuperClass, isAbstract, isConcrete, isFinal, isIndependent, isInterface`

Constructor Detail

### StandardAnnotationMetadata

    public StandardAnnotationMetadata(java.lang.Class<?> introspectedClass)

  Create a new `StandardAnnotationMetadata` wrapper for the given Class.

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

### StandardAnnotationMetadata

    public StandardAnnotationMetadata(java.lang.Class<?> introspectedClass,
                                      boolean nestedAnnotationsAsMap)

  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 instrospect
    `nestedAnnotationsAsMap` - return nested annotations and annotation arrays as `AnnotationAttributes` for compatibility with ASM-based `AnnotationMetadata` implementations
  Since:
    3.1.1

Method Detail

### getAnnotationTypes

    public java.util.Set<java.lang.String> getAnnotationTypes()

  Description copied from interface: `AnnotationMetadata`
  Return the names of all annotation types defined on the underlying class.

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

### getMetaAnnotationTypes

    public java.util.Set<java.lang.String> getMetaAnnotationTypes(java.lang.String annotationType)

  Description copied from interface: `AnnotationMetadata`
  Return the names of all meta-annotation types defined on the given annotation type of the underlying class.

  Specified by:
    `getMetaAnnotationTypes` in interface `AnnotationMetadata`
  Parameters:
    `annotationType` - the meta-annotation type to look for
  Returns:
    the meta-annotation type names

### hasAnnotation

    public boolean hasAnnotation(java.lang.String annotationType)

  Description copied from interface: `AnnotationMetadata`
  Determine whether the underlying class has an annotation of the given type defined.

  Specified by:
    `hasAnnotation` in interface `AnnotationMetadata`
  Parameters:
    `annotationType` - the annotation type to look for
  Returns:
    whether a matching annotation is defined

### hasMetaAnnotation

    public boolean hasMetaAnnotation(java.lang.String annotationType)

  Description copied from interface: `AnnotationMetadata`
  Determine whether the underlying class has an annotation that is itself annotated with the meta-annotation of the given type.

  Specified by:
    `hasMetaAnnotation` in interface `AnnotationMetadata`
  Parameters:
    `annotationType` - the meta-annotation type to look for
  Returns:
    whether a matching meta-annotation is defined

### isAnnotated

    public boolean isAnnotated(java.lang.String annotationType)

  Description copied from interface: `AnnotationMetadata`
  Determine whether the underlying class has an annotation or meta-annotation of the given type defined.

  This is equivalent to a "hasAnnotation || hasMetaAnnotation" check. If this method returns `true`, then `AnnotationMetadata.getAnnotationAttributes(java.lang.String)` will return a non-null Map.

  Specified by:
    `isAnnotated` in interface `AnnotationMetadata`
  Parameters:
    `annotationType` - the annotation type to look for
  Returns:
    whether a matching annotation is defined

### getAnnotationAttributes

    public java.util.Map<java.lang.String,java.lang.Object> getAnnotationAttributes(java.lang.String annotationType)

  Description copied from interface: `AnnotationMetadata`
  Retrieve the attributes of the annotation of the given type, if any (i.e. if defined on the underlying class, as direct annotation or as meta-annotation).

  Specified by:
    `getAnnotationAttributes` in interface `AnnotationMetadata`
  Parameters:
    `annotationType` - the annotation type to look for
  Returns:
    a Map of attributes, with the attribute name as key (e.g. "value") and the defined attribute value as Map value. This return value will be `null` if no matching annotation is defined.

### getAnnotationAttributes

    public java.util.Map<java.lang.String,java.lang.Object> getAnnotationAttributes(java.lang.String annotationType,
                                                                                    boolean classValuesAsString)

  Description copied from interface: `AnnotationMetadata`
  Retrieve the attributes of the annotation of the given type, if any (i.e. if defined on the underlying class, as direct annotation or as meta-annotation).

  Specified by:
    `getAnnotationAttributes` in interface `AnnotationMetadata`
  Parameters:
    `annotationType` - 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 the attribute name as key (e.g. "value") and the defined attribute value as Map value. This return value will be `null` if no matching annotation is defined.

### hasAnnotatedMethods

    public boolean hasAnnotatedMethods(java.lang.String annotationType)

  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`

### getAnnotatedMethods

    public java.util.Set<MethodMetadata> getAnnotatedMethods(java.lang.String annotationType)

  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, `MethodMetadata.isAnnotated(java.lang.String)` will return `true` for the given annotation type.

  Specified by:
    `getAnnotatedMethods` in interface `AnnotationMetadata`
  Parameters:
    `annotationType` - 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.

Overview | Package | Class | Tree | Deprecated | Index | Help
| Spring Framework
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD