public class StandardAnnotationMetadata extends StandardClassMetadata implements AnnotationMetadata
AnnotationMetadata implementation that uses standard reflection
to introspect a given Class.| Constructor and Description |
|---|
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. |
| Modifier and Type | Method and Description |
|---|---|
MultiValueMap<java.lang.String,java.lang.Object> |
getAllAnnotationAttributes(java.lang.String annotationName)
Retrieve all attributes of all annotations of the given type, if any (i.e.
|
MultiValueMap<java.lang.String,java.lang.Object> |
getAllAnnotationAttributes(java.lang.String annotationName,
boolean classValuesAsString)
Retrieve all attributes of all annotations of the given type, if any (i.e.
|
java.util.Set<MethodMetadata> |
getAnnotatedMethods(java.lang.String annotationName)
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 annotationName)
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 annotationName,
boolean classValuesAsString)
Retrieve the attributes of the annotation of the given type, if any (i.e.
|
java.util.Set<java.lang.String> |
getAnnotationTypes()
Get the fully qualified class names of all annotation types that
are present on the underlying class.
|
java.util.Set<java.lang.String> |
getMetaAnnotationTypes(java.lang.String annotationName)
Get the fully qualified class names of all meta-annotation types that
are present on the given annotation type on the underlying class.
|
boolean |
hasAnnotatedMethods(java.lang.String annotationName)
Determine whether the underlying class has any methods that are
annotated (or meta-annotated) with the given annotation type.
|
boolean |
hasAnnotation(java.lang.String annotationName)
Determine whether an annotation of the given type is present on
the underlying class.
|
boolean |
hasMetaAnnotation(java.lang.String annotationName)
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 annotationName)
Determine whether the underlying element has an annotation or meta-annotation
of the given type defined.
|
getClassName, getEnclosingClassName, getInterfaceNames, getIntrospectedClass, getMemberClassNames, getSuperClassName, hasEnclosingClass, hasSuperClass, isAbstract, isAnnotation, isConcrete, isFinal, isIndependent, isInterfaceclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetClassName, getEnclosingClassName, getInterfaceNames, getMemberClassNames, getSuperClassName, hasEnclosingClass, hasSuperClass, isAbstract, isAnnotation, isConcrete, isFinal, isIndependent, isInterfacepublic StandardAnnotationMetadata(java.lang.Class<?> introspectedClass)
StandardAnnotationMetadata wrapper for the given Class.introspectedClass - the Class to introspectStandardAnnotationMetadata(Class, boolean)public StandardAnnotationMetadata(java.lang.Class<?> introspectedClass,
boolean nestedAnnotationsAsMap)
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.introspectedClass - the Class to introspectnestedAnnotationsAsMap - return nested annotations and annotation arrays as
AnnotationAttributes for compatibility
with ASM-based AnnotationMetadata implementationspublic java.util.Set<java.lang.String> getAnnotationTypes()
AnnotationMetadatagetAnnotationTypes in interface AnnotationMetadatapublic java.util.Set<java.lang.String> getMetaAnnotationTypes(java.lang.String annotationName)
AnnotationMetadatagetMetaAnnotationTypes in interface AnnotationMetadataannotationName - the fully qualified class name of the meta-annotation
type to look forpublic boolean hasAnnotation(java.lang.String annotationName)
AnnotationMetadatahasAnnotation in interface AnnotationMetadataannotationName - the fully qualified class name of the annotation
type to look fortrue if a matching annotation is presentpublic boolean hasMetaAnnotation(java.lang.String annotationName)
AnnotationMetadatahasMetaAnnotation in interface AnnotationMetadataannotationName - the fully qualified class name of the
meta-annotation type to look fortrue if a matching meta-annotation is presentpublic boolean isAnnotated(java.lang.String annotationName)
AnnotatedTypeMetadataIf this method returns true, then
AnnotatedTypeMetadata.getAnnotationAttributes(java.lang.String) will return a non-null Map.
isAnnotated in interface AnnotatedTypeMetadataannotationName - the fully qualified class name of the annotation
type to look forpublic java.util.Map<java.lang.String,java.lang.Object> getAnnotationAttributes(java.lang.String annotationName)
AnnotatedTypeMetadatagetAnnotationAttributes in interface AnnotatedTypeMetadataannotationName - the fully qualified class name of the annotation
type to look fornull if no matching annotation is defined.public java.util.Map<java.lang.String,java.lang.Object> getAnnotationAttributes(java.lang.String annotationName,
boolean classValuesAsString)
AnnotatedTypeMetadatagetAnnotationAttributes in interface AnnotatedTypeMetadataannotationName - the fully qualified class name of the annotation
type to look forclassValuesAsString - 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 firstnull if no matching annotation is defined.public MultiValueMap<java.lang.String,java.lang.Object> getAllAnnotationAttributes(java.lang.String annotationName)
AnnotatedTypeMetadatagetAllAnnotationAttributes in interface AnnotatedTypeMetadataannotationName - the fully qualified class name of the annotation
type to look fornull if no matching annotation is defined.AnnotatedTypeMetadata.getAllAnnotationAttributes(String, boolean)public MultiValueMap<java.lang.String,java.lang.Object> getAllAnnotationAttributes(java.lang.String annotationName, boolean classValuesAsString)
AnnotatedTypeMetadatagetAllAnnotationAttributes in interface AnnotatedTypeMetadataannotationName - the fully qualified class name of the annotation
type to look forclassValuesAsString - whether to convert class references to Stringnull if no matching annotation is defined.AnnotatedTypeMetadata.getAllAnnotationAttributes(String)public boolean hasAnnotatedMethods(java.lang.String annotationName)
AnnotationMetadatahasAnnotatedMethods in interface AnnotationMetadataannotationName - the fully qualified class name of the annotation
type to look forpublic java.util.Set<MethodMetadata> getAnnotatedMethods(java.lang.String annotationName)
AnnotationMetadataFor any returned method, AnnotatedTypeMetadata.isAnnotated(java.lang.String) will
return true for the given annotation type.
getAnnotatedMethods in interface AnnotationMetadataannotationName - the fully qualified class name of the annotation
type to look forMethodMetadata for methods that have a matching
annotation. The return value will be an empty set if no methods match
the annotation type.