|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.springframework.core.type.classreading.ClassMetadataReadingVisitor
org.springframework.core.type.classreading.AnnotationMetadataReadingVisitor
final class AnnotationMetadataReadingVisitor
ASM class visitor which looks for the class name and implemented types as
well as for the annotations defined on the class, exposing them through
the AnnotationMetadata
interface.
Field Summary | |
---|---|
private java.util.Set<java.lang.String> |
annotationSet
|
private java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.Object>> |
attributeMap
|
private java.lang.ClassLoader |
classLoader
|
private java.util.Map<java.lang.String,java.util.Set<java.lang.String>> |
metaAnnotationMap
|
private MultiValueMap<java.lang.String,MethodMetadata> |
methodMetadataMap
|
Constructor Summary | |
---|---|
AnnotationMetadataReadingVisitor(java.lang.ClassLoader classLoader)
|
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 metaAnnotationType)
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. |
AnnotationVisitor |
visitAnnotation(java.lang.String desc,
boolean visible)
|
MethodVisitor |
visitMethod(int access,
java.lang.String name,
java.lang.String desc,
java.lang.String signature,
java.lang.String[] exceptions)
|
Methods inherited from class org.springframework.core.type.classreading.ClassMetadataReadingVisitor |
---|
getClassName, getEnclosingClassName, getInterfaceNames, getMemberClassNames, getSuperClassName, hasEnclosingClass, hasSuperClass, isAbstract, isConcrete, isFinal, isIndependent, isInterface, visit, visitAttribute, visitEnd, visitField, visitInnerClass, visitOuterClass, visitSource |
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 |
Field Detail |
---|
private final java.lang.ClassLoader classLoader
private final java.util.Set<java.lang.String> annotationSet
private final java.util.Map<java.lang.String,java.util.Set<java.lang.String>> metaAnnotationMap
private final java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.Object>> attributeMap
private final MultiValueMap<java.lang.String,MethodMetadata> methodMetadataMap
Constructor Detail |
---|
public AnnotationMetadataReadingVisitor(java.lang.ClassLoader classLoader)
Method Detail |
---|
public MethodVisitor visitMethod(int access, java.lang.String name, java.lang.String desc, java.lang.String signature, java.lang.String[] exceptions)
visitMethod
in class ClassMetadataReadingVisitor
public AnnotationVisitor visitAnnotation(java.lang.String desc, boolean visible)
visitAnnotation
in class ClassMetadataReadingVisitor
public java.util.Set<java.lang.String> getAnnotationTypes()
AnnotationMetadata
getAnnotationTypes
in interface AnnotationMetadata
public java.util.Set<java.lang.String> getMetaAnnotationTypes(java.lang.String annotationType)
AnnotationMetadata
getMetaAnnotationTypes
in interface AnnotationMetadata
annotationType
- the meta-annotation type to look for
public boolean hasAnnotation(java.lang.String annotationType)
AnnotationMetadata
hasAnnotation
in interface AnnotationMetadata
annotationType
- the annotation type to look for
public boolean hasMetaAnnotation(java.lang.String metaAnnotationType)
AnnotationMetadata
hasMetaAnnotation
in interface AnnotationMetadata
metaAnnotationType
- the meta-annotation type to look for
public boolean isAnnotated(java.lang.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 java.util.Map<java.lang.String,java.lang.Object> getAnnotationAttributes(java.lang.String annotationType)
AnnotationMetadata
getAnnotationAttributes
in interface AnnotationMetadata
annotationType
- the annotation type to look for
null
if no matching annotation is defined.public java.util.Map<java.lang.String,java.lang.Object> getAnnotationAttributes(java.lang.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(java.lang.String annotationType)
AnnotationMetadata
hasAnnotatedMethods
in interface AnnotationMetadata
public java.util.Set<MethodMetadata> getAnnotatedMethods(java.lang.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 |