public class StandardAnnotationMetadata extends StandardClassMetadata implements AnnotationMetadata
AnnotationMetadata
implementation that uses standard reflection
to introspect a given Class
.Constructor and 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) .
Use MergedAnnotation.asMap
from getAnnotations() rather than AnnotatedTypeMetadata.getAnnotationAttributes(String)
if nestedAnnotationsAsMap is false |
Modifier and Type | Method and 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()
Return annotation details based on the direct annotations of the
underlying element.
|
Set<String> |
getAnnotationTypes()
Get the fully qualified class names of all annotation types that
are present on the underlying class.
|
boolean |
hasAnnotatedMethods(String annotationName)
Determine whether the underlying class has any methods that are
annotated (or meta-annotated) with the given annotation type.
|
getClassName, getEnclosingClassName, getInterfaceNames, getIntrospectedClass, getMemberClassNames, getSuperClassName, isAbstract, isAnnotation, isFinal, isIndependent, isInterface
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getMetaAnnotationTypes, hasAnnotation, hasMetaAnnotation, introspect
getClassName, getEnclosingClassName, getInterfaceNames, getMemberClassNames, getSuperClassName, hasEnclosingClass, hasSuperClass, isAbstract, isAnnotation, isConcrete, isFinal, isIndependent, isInterface
getAllAnnotationAttributes, getAnnotationAttributes, isAnnotated
@Deprecated public StandardAnnotationMetadata(Class<?> introspectedClass)
AnnotationMetadata.introspect(Class)
StandardAnnotationMetadata
wrapper for the given Class.introspectedClass
- the Class to introspectStandardAnnotationMetadata(Class, boolean)
@Deprecated public StandardAnnotationMetadata(Class<?> introspectedClass, boolean nestedAnnotationsAsMap)
AnnotationMetadata.introspect(Class)
.
Use MergedAnnotation.asMap
from getAnnotations()
rather than AnnotatedTypeMetadata.getAnnotationAttributes(String)
if nestedAnnotationsAsMap
is false
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 MergedAnnotations getAnnotations()
AnnotatedTypeMetadata
getAnnotations
in interface AnnotatedTypeMetadata
public Set<String> getAnnotationTypes()
AnnotationMetadata
getAnnotationTypes
in interface AnnotationMetadata
@Nullable public Map<String,Object> getAnnotationAttributes(String annotationName, boolean classValuesAsString)
AnnotatedTypeMetadata
getAnnotationAttributes
in interface AnnotatedTypeMetadata
annotationName
- 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.@Nullable public MultiValueMap<String,Object> getAllAnnotationAttributes(String annotationName, boolean classValuesAsString)
AnnotatedTypeMetadata
getAllAnnotationAttributes
in interface AnnotatedTypeMetadata
annotationName
- 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(String annotationName)
AnnotationMetadata
hasAnnotatedMethods
in interface AnnotationMetadata
annotationName
- the fully qualified class name of the annotation
type to look forpublic Set<MethodMetadata> getAnnotatedMethods(String annotationName)
AnnotationMetadata
For any returned method, AnnotatedTypeMetadata.isAnnotated(java.lang.String)
will
return true
for the given annotation type.
getAnnotatedMethods
in interface AnnotationMetadata
annotationName
- 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.