SimpleAnnotationMetadataReadingVisitor
for internal use within the
framework, but there is no public replacement for
AnnotationMetadataReadingVisitor
.@Deprecated public class AnnotationMetadataReadingVisitor extends ClassVisitor implements AnnotationMetadata
AnnotationMetadata
interface.Modifier and Type | Field and Description |
---|---|
protected Set<String> |
annotationSet
Deprecated.
|
protected LinkedMultiValueMap<String,AnnotationAttributes> |
attributesMap
Deprecated.
Declared as a
LinkedMultiValueMap instead of a MultiValueMap
to ensure that the hierarchical ordering of the entries is preserved. |
protected ClassLoader |
classLoader
Deprecated.
|
protected Map<String,Set<String>> |
metaAnnotationMap
Deprecated.
|
protected Set<MethodMetadata> |
methodMetadataSet
Deprecated.
|
api, cv
Constructor and Description |
---|
AnnotationMetadataReadingVisitor(ClassLoader classLoader)
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
MultiValueMap<String,Object> |
getAllAnnotationAttributes(String annotationName,
boolean classValuesAsString)
Deprecated.
Retrieve all attributes of all annotations of the given type, if any (i.e.
|
Set<MethodMetadata> |
getAnnotatedMethods(String annotationName)
Deprecated.
Retrieve the method metadata for all methods that are annotated
(or meta-annotated) with the given annotation type.
|
AnnotationAttributes |
getAnnotationAttributes(String annotationName,
boolean classValuesAsString)
Deprecated.
Retrieve the attributes of the annotation of the given type, if any (i.e.
|
MergedAnnotations |
getAnnotations()
Deprecated.
Return annotation details based on the direct annotations of the
underlying element.
|
Set<String> |
getAnnotationTypes()
Deprecated.
Get the fully qualified class names of all annotation types that
are present on the underlying class.
|
String |
getClassName()
Deprecated.
Return the name of the underlying class.
|
String |
getEnclosingClassName()
Deprecated.
Return the name of the enclosing class of the underlying class,
or
null if the underlying class is a top-level class. |
String[] |
getInterfaceNames()
Deprecated.
Return the names of all interfaces that the underlying class
implements, or an empty array if there are none.
|
String[] |
getMemberClassNames()
Deprecated.
Return the names of all classes declared as members of the class represented by
this ClassMetadata object.
|
Set<String> |
getMetaAnnotationTypes(String annotationName)
Deprecated.
Get the fully qualified class names of all meta-annotation types that
are present on the given annotation type on the underlying class.
|
String |
getSuperClassName()
Deprecated.
Return the name of the superclass of the underlying class,
or
null if there is no superclass defined. |
boolean |
hasAnnotatedMethods(String annotationName)
Deprecated.
Determine whether the underlying class has any methods that are
annotated (or meta-annotated) with the given annotation type.
|
boolean |
hasAnnotation(String annotationName)
Deprecated.
Determine whether an annotation of the given type is present on
the underlying class.
|
boolean |
hasEnclosingClass()
Deprecated.
Return whether the underlying class is declared within an enclosing
class (i.e.
|
boolean |
hasMetaAnnotation(String metaAnnotationType)
Deprecated.
Determine whether the underlying class has an annotation that is itself
annotated with the meta-annotation of the given type.
|
boolean |
isAbstract()
Deprecated.
Return whether the underlying class is marked as abstract.
|
boolean |
isAnnotated(String annotationName)
Deprecated.
Determine whether the underlying element has an annotation or meta-annotation
of the given type defined.
|
boolean |
isAnnotation()
Deprecated.
Return whether the underlying class represents an annotation.
|
boolean |
isFinal()
Deprecated.
Return whether the underlying class is marked as 'final'.
|
boolean |
isIndependent()
Deprecated.
Determine whether the underlying class is independent, i.e.
|
boolean |
isInterface()
Deprecated.
Return whether the underlying class represents an interface.
|
void |
visit(int version,
int access,
String name,
String signature,
String supername,
String[] interfaces)
Deprecated.
Visits the header of the class.
|
AnnotationVisitor |
visitAnnotation(String desc,
boolean visible)
Deprecated.
Visits an annotation of the class.
|
void |
visitAttribute(Attribute attr)
Deprecated.
Visits a non standard attribute of the class.
|
void |
visitEnd()
Deprecated.
Visits the end of the class.
|
FieldVisitor |
visitField(int access,
String name,
String desc,
String signature,
Object value)
Deprecated.
Visits a field of the class.
|
void |
visitInnerClass(String name,
String outerName,
String innerName,
int access)
Deprecated.
Visits information about an inner class.
|
MethodVisitor |
visitMethod(int access,
String name,
String desc,
String signature,
String[] exceptions)
Deprecated.
Visits a method of the class.
|
void |
visitOuterClass(String owner,
String name,
String desc)
Deprecated.
Visits the enclosing class of the class.
|
void |
visitSource(String source,
String debug)
Deprecated.
Visits the source of the class.
|
getDelegate, visitModule, visitNestHost, visitNestMember, visitPermittedSubclass, visitRecordComponent, visitTypeAnnotation
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
introspect
getClassName, getEnclosingClassName, getInterfaceNames, getMemberClassNames, getSuperClassName, hasEnclosingClass, hasSuperClass, isAbstract, isAnnotation, isConcrete, isFinal, isIndependent, isInterface
getAllAnnotationAttributes, getAnnotationAttributes
@Nullable protected final ClassLoader classLoader
protected final LinkedMultiValueMap<String,AnnotationAttributes> attributesMap
LinkedMultiValueMap
instead of a MultiValueMap
to ensure that the hierarchical ordering of the entries is preserved.AnnotationReadingVisitorUtils.getMergedAnnotationAttributes(org.springframework.util.LinkedMultiValueMap<java.lang.String, org.springframework.core.annotation.AnnotationAttributes>, java.util.Map<java.lang.String, java.util.Set<java.lang.String>>, java.lang.String)
protected final Set<MethodMetadata> methodMetadataSet
public AnnotationMetadataReadingVisitor(@Nullable ClassLoader classLoader)
public MergedAnnotations getAnnotations()
AnnotatedTypeMetadata
getAnnotations
in interface AnnotatedTypeMetadata
public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions)
ClassVisitor
MethodVisitor
instance (or null) each time it is called, i.e., it should not return a previously
returned visitor.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 Type.getInternalName()
). May be null.@Nullable public AnnotationVisitor visitAnnotation(String desc, boolean visible)
ClassVisitor
desc
- the class descriptor of the annotation class.visible
- true if the annotation is visible at runtime.public Set<String> getAnnotationTypes()
AnnotationMetadata
getAnnotationTypes
in interface AnnotationMetadata
public Set<String> getMetaAnnotationTypes(String annotationName)
AnnotationMetadata
getMetaAnnotationTypes
in interface AnnotationMetadata
annotationName
- the fully qualified class name of the meta-annotation
type to look forpublic boolean hasMetaAnnotation(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(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 boolean hasAnnotation(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 present@Nullable public AnnotationAttributes 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.public void visit(int version, int access, String name, String signature, @Nullable String supername, String[] interfaces)
ClassVisitor
visit
in class ClassVisitor
version
- the class version. The minor version is stored in the 16 most significant bits,
and the major version in the 16 least significant bits.access
- the class's access flags (see Opcodes
). This parameter also indicates if
the class is deprecated Opcodes.ACC_DEPRECATED
or a record Opcodes.ACC_RECORD
.name
- the internal name of the class (see Type.getInternalName()
).signature
- the signature of this class. May be null if the class is not a
generic one, and does not extend or implement generic classes or interfaces.supername
- the internal of name of the super class (see Type.getInternalName()
).
For interfaces, the super class is Object
. May be null, but only for the
Object
class.interfaces
- the internal names of the class's interfaces (see Type.getInternalName()
). May be null.public void visitOuterClass(String owner, String name, String desc)
ClassVisitor
visitOuterClass
in class ClassVisitor
owner
- internal name of the enclosing class of the class (see Type.getInternalName()
).name
- the name of the method that contains the class, or null if the class is
not enclosed in a method or constructor of its enclosing class (e.g. if it is enclosed in
an instance initializer, static initializer, instance variable initializer, or class
variable initializer).desc
- the descriptor of the method that contains the class, or null if
the class is not enclosed in a method or constructor of its enclosing class (e.g. if it is
enclosed in an instance initializer, static initializer, instance variable initializer, or
class variable initializer).public void visitInnerClass(String name, @Nullable String outerName, String innerName, int access)
ClassVisitor
visitInnerClass
in class ClassVisitor
name
- the internal name of C (see Type.getInternalName()
).outerName
- the internal name of the class or interface C is a member of (see Type.getInternalName()
). Must be null if C is not the member of a class or
interface (e.g. for local or anonymous classes).innerName
- the (simple) name of C. Must be null for anonymous inner classes.access
- the access flags of C originally declared in the source code from which this
class was compiled.public void visitSource(String source, String debug)
ClassVisitor
visitSource
in class ClassVisitor
source
- the name of the source file from which the class was compiled. May be null.debug
- additional debug information to compute the correspondence between source and
compiled elements of the class. May be null.public void visitAttribute(Attribute attr)
ClassVisitor
visitAttribute
in class ClassVisitor
attr
- an attribute.public FieldVisitor visitField(int access, String name, String desc, String signature, Object value)
ClassVisitor
visitField
in class ClassVisitor
access
- the field's access flags (see Opcodes
). This parameter also indicates if
the field is synthetic and/or deprecated.name
- the field's name.desc
- the field's descriptor (see Type
).signature
- the field's signature. May be null if the field's type does not use
generic types.value
- the field's initial value. This parameter, which may be null if the
field does not have an initial value, must be an Integer
, a Float
, a Long
, a Double
or a String
(for int
, float
, long
or String
fields respectively). This parameter is only used for static
fields. Its value is ignored for non static fields, which must be initialized through
bytecode instructions in constructors or methods.public void visitEnd()
ClassVisitor
visitEnd
in class ClassVisitor
public String getClassName()
ClassMetadata
getClassName
in interface ClassMetadata
public boolean isInterface()
ClassMetadata
isInterface
in interface ClassMetadata
public boolean isAnnotation()
ClassMetadata
isAnnotation
in interface ClassMetadata
public boolean isAbstract()
ClassMetadata
isAbstract
in interface ClassMetadata
public boolean isFinal()
ClassMetadata
isFinal
in interface ClassMetadata
public boolean isIndependent()
ClassMetadata
isIndependent
in interface ClassMetadata
public boolean hasEnclosingClass()
ClassMetadata
If this method returns false
, then the underlying
class is a top-level class.
hasEnclosingClass
in interface ClassMetadata
@Nullable public String getEnclosingClassName()
ClassMetadata
null
if the underlying class is a top-level class.getEnclosingClassName
in interface ClassMetadata
@Nullable public String getSuperClassName()
ClassMetadata
null
if there is no superclass defined.getSuperClassName
in interface ClassMetadata
public String[] getInterfaceNames()
ClassMetadata
getInterfaceNames
in interface ClassMetadata
public String[] getMemberClassNames()
ClassMetadata
getMemberClassNames
in interface ClassMetadata