|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.core.type.StandardClassMetadata org.springframework.core.type.StandardAnnotationMetadata
public class StandardAnnotationMetadata
AnnotationMetadata
implementation that uses standard reflection
to introspect a given Class
.
Constructor Summary | |
---|---|
StandardAnnotationMetadata(Class<?> introspectedClass)
Create a new StandardAnnotationMetadata wrapper for the given Class. |
|
StandardAnnotationMetadata(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 | |
---|---|
Set<MethodMetadata> |
getAnnotatedMethods(String annotationType)
Retrieve the method metadata for all methods that are annotated (or meta-annotated) with the given annotation type. |
Map<String,Object> |
getAnnotationAttributes(String annotationType)
Retrieve the attributes of the annotation of the given type, if any (i.e. |
Map<String,Object> |
getAnnotationAttributes(String annotationType,
boolean classValuesAsString)
Retrieve the attributes of the annotation of the given type, if any (i.e. |
Set<String> |
getAnnotationTypes()
Return the names of all annotation types defined on the underlying class. |
Set<String> |
getMetaAnnotationTypes(String annotationType)
Return the names of all meta-annotation types defined on the given annotation type of the underlying class. |
boolean |
hasAnnotatedMethods(String annotationType)
Determine whether the underlying class has any methods that are annotated (or meta-annotated) with the given annotation type. |
boolean |
hasAnnotation(String annotationType)
Determine whether the underlying class has an annotation of the given type defined. |
boolean |
hasMetaAnnotation(String annotationType)
Determine whether the underlying class has an annotation that is itself annotated with the meta-annotation of the given type. |
boolean |
isAnnotated(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 |
---|
public StandardAnnotationMetadata(Class<?> introspectedClass)
StandardAnnotationMetadata
wrapper for the given Class.
introspectedClass
- the Class to introspectStandardAnnotationMetadata(Class, boolean)
public StandardAnnotationMetadata(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 instrospectnestedAnnotationsAsMap
- return nested annotations and annotation arrays as
AnnotationAttributes
for compatibility with ASM-based
AnnotationMetadata
implementationsMethod Detail |
---|
public Set<String> getAnnotationTypes()
AnnotationMetadata
getAnnotationTypes
in interface AnnotationMetadata
public Set<String> getMetaAnnotationTypes(String annotationType)
AnnotationMetadata
getMetaAnnotationTypes
in interface AnnotationMetadata
annotationType
- the meta-annotation type to look for
public boolean hasAnnotation(String annotationType)
AnnotationMetadata
hasAnnotation
in interface AnnotationMetadata
annotationType
- the annotation type to look for
public boolean hasMetaAnnotation(String annotationType)
AnnotationMetadata
hasMetaAnnotation
in interface AnnotationMetadata
annotationType
- the meta-annotation type to look for
public boolean isAnnotated(String annotationType)
AnnotationMetadata
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.
isAnnotated
in interface AnnotationMetadata
annotationType
- the annotation type to look for
public Map<String,Object> getAnnotationAttributes(String annotationType)
AnnotationMetadata
getAnnotationAttributes
in interface AnnotationMetadata
annotationType
- the annotation type to look for
null
if no matching annotation is defined.public Map<String,Object> getAnnotationAttributes(String annotationType, boolean classValuesAsString)
AnnotationMetadata
getAnnotationAttributes
in interface AnnotationMetadata
annotationType
- 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 first
null
if no matching annotation is defined.public boolean hasAnnotatedMethods(String annotationType)
AnnotationMetadata
hasAnnotatedMethods
in interface AnnotationMetadata
public Set<MethodMetadata> getAnnotatedMethods(String annotationType)
AnnotationMetadata
For any returned method, MethodMetadata.isAnnotated(java.lang.String)
will
return true
for the given annotation type.
getAnnotatedMethods
in interface AnnotationMetadata
annotationType
- the annotation type to look for
MethodMetadata
for methods that have a matching
annotation. The return value will be an empty set if no methods match
the annotation type.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |