public class AnnotationMetadataReadingVisitor extends ClassMetadataReadingVisitor implements AnnotationMetadata
AnnotationMetadata
interface.Modifier and Type | Field and Description |
---|---|
protected java.util.Set<java.lang.String> |
annotationSet |
protected LinkedMultiValueMap<java.lang.String,AnnotationAttributes> |
attributesMap
Declared as a
LinkedMultiValueMap instead of a MultiValueMap
to ensure that the hierarchical ordering of the entries is preserved. |
protected java.lang.ClassLoader |
classLoader |
protected java.util.Map<java.lang.String,java.util.Set<java.lang.String>> |
metaAnnotationMap |
protected java.util.Set<MethodMetadata> |
methodMetadataSet |
api, cv
Constructor and Description |
---|
AnnotationMetadataReadingVisitor(java.lang.ClassLoader classLoader) |
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.
|
AnnotationAttributes |
getAnnotationAttributes(java.lang.String annotationName)
Retrieve the attributes of the annotation of the given type, if any (i.e.
|
AnnotationAttributes |
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 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 annotationName)
Determine whether the underlying element has an annotation or meta-annotation
of the given type defined.
|
AnnotationVisitor |
visitAnnotation(java.lang.String desc,
boolean visible)
Visits an annotation of the class.
|
MethodVisitor |
visitMethod(int access,
java.lang.String name,
java.lang.String desc,
java.lang.String signature,
java.lang.String[] exceptions)
Visits a method of the class.
|
getClassName, getEnclosingClassName, getInterfaceNames, getMemberClassNames, getSuperClassName, hasEnclosingClass, hasSuperClass, isAbstract, isAnnotation, isConcrete, isFinal, isIndependent, isInterface, visit, visitAttribute, visitEnd, visitField, visitInnerClass, visitOuterClass, visitSource
visitTypeAnnotation
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getClassName, getEnclosingClassName, getInterfaceNames, getMemberClassNames, getSuperClassName, hasEnclosingClass, hasSuperClass, isAbstract, isAnnotation, isConcrete, isFinal, isIndependent, isInterface
protected final java.lang.ClassLoader classLoader
protected final java.util.Set<java.lang.String> annotationSet
protected final java.util.Map<java.lang.String,java.util.Set<java.lang.String>> metaAnnotationMap
protected final LinkedMultiValueMap<java.lang.String,AnnotationAttributes> attributesMap
LinkedMultiValueMap
instead of a MultiValueMap
to ensure that the hierarchical ordering of the entries is preserved.protected final java.util.Set<MethodMetadata> methodMetadataSet
public AnnotationMetadataReadingVisitor(java.lang.ClassLoader classLoader)
public MethodVisitor visitMethod(int access, java.lang.String name, java.lang.String desc, java.lang.String signature, java.lang.String[] exceptions)
ClassVisitor
MethodVisitor
instance (or null) each time it is called,
i.e., it should not return a previously returned visitor.visitMethod
in class ClassMetadataReadingVisitor
access
- the method's access flags (see Opcodes
). This
parameter also indicates if the method is synthetic and/or
deprecated.name
- the method's name.desc
- the method's descriptor (see Type
).signature
- the method's signature. May be null if the method
parameters, return type and exceptions do not use generic
types.exceptions
- the internal names of the method's exception classes (see
getInternalName
). May be
null.public AnnotationVisitor visitAnnotation(java.lang.String desc, boolean visible)
ClassVisitor
visitAnnotation
in class ClassMetadataReadingVisitor
desc
- the class descriptor of the annotation class.visible
- true if the annotation is visible at runtime.public java.util.Set<java.lang.String> getAnnotationTypes()
AnnotationMetadata
getAnnotationTypes
in interface AnnotationMetadata
public java.util.Set<java.lang.String> getMetaAnnotationTypes(java.lang.String annotationName)
AnnotationMetadata
getMetaAnnotationTypes
in interface AnnotationMetadata
annotationName
- the fully qualified class name of the meta-annotation
type to look forpublic boolean hasAnnotation(java.lang.String annotationName)
AnnotationMetadata
hasAnnotation
in interface AnnotationMetadata
annotationName
- the fully qualified class name of the annotation
type to look fortrue
if a matching annotation is presentpublic boolean hasMetaAnnotation(java.lang.String metaAnnotationType)
AnnotationMetadata
hasMetaAnnotation
in interface AnnotationMetadata
metaAnnotationType
- 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)
AnnotatedTypeMetadata
If this method returns true
, then
AnnotatedTypeMetadata.getAnnotationAttributes(java.lang.String)
will return a non-null Map.
isAnnotated
in interface AnnotatedTypeMetadata
annotationName
- the fully qualified class name of the annotation
type to look forpublic AnnotationAttributes getAnnotationAttributes(java.lang.String annotationName)
AnnotatedTypeMetadata
getAnnotationAttributes
in interface AnnotatedTypeMetadata
annotationName
- the fully qualified class name of the annotation
type to look fornull
if no matching annotation is defined.public AnnotationAttributes getAnnotationAttributes(java.lang.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.public MultiValueMap<java.lang.String,java.lang.Object> getAllAnnotationAttributes(java.lang.String annotationName)
AnnotatedTypeMetadata
getAllAnnotationAttributes
in interface AnnotatedTypeMetadata
annotationName
- 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)
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(java.lang.String annotationName)
AnnotationMetadata
hasAnnotatedMethods
in interface AnnotationMetadata
annotationName
- the fully qualified class name of the annotation
type to look forpublic java.util.Set<MethodMetadata> getAnnotatedMethods(java.lang.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.