public class CollectClassData extends EmptyVisitor
Modifier and Type | Class and Description |
---|---|
static class |
CollectClassData.AnnotationEnum
Holds the descriptor and value for an Enum-valued annotation.
|
static class |
CollectClassData.ClassType
Type of this class.
|
av, fv, mv
api, cv
Constructor and Description |
---|
CollectClassData()
Construct a visitor that will collect data about a class.
|
Modifier and Type | Method and Description |
---|---|
int |
getAccess() |
List<CollectAnnotationData> |
getAnnotations() |
CollectClassData.ClassType |
getClassType() |
List<CollectFieldData> |
getFields() |
String[] |
getInterfaces() |
List<CollectMethodData> |
getMethods() |
String |
getName() |
String |
getOuterClass() |
String |
getOuterMethodDesc() |
String |
getOuterMethodName() |
String |
getSignature() |
String |
getSource() |
String |
getSuperName() |
boolean |
hasNoExternalName() |
boolean |
isAnonymous() |
String |
toString() |
void |
visit(int version,
int access,
String name,
String signature,
String superName,
String[] interfaces)
Called at the beginning of visiting the class.
|
AnnotationVisitor |
visitAnnotation(String desc,
boolean visible)
Visits an annotation of the class.
|
FieldVisitor |
visitField(int access,
String name,
String desc,
String signature,
Object value)
Called for each field.
|
void |
visitInnerClass(String name,
String outerName,
String innerName,
int access)
Called once for every inner class of this class.
|
MethodVisitor |
visitMethod(int access,
String name,
String desc,
String signature,
String[] exceptions)
Visits a method of the class.
|
void |
visitOuterClass(String owner,
String name,
String desc)
Visits the enclosing class of the class.
|
void |
visitSource(String source,
String debug)
If compiled with debug, visit the source information.
|
visitAttribute, visitEnd
public CollectClassData()
public int getAccess()
public List<CollectAnnotationData> getAnnotations()
public CollectClassData.ClassType getClassType()
public List<CollectFieldData> getFields()
public String[] getInterfaces()
public List<CollectMethodData> getMethods()
public String getName()
public String getOuterClass()
public String getOuterMethodDesc()
public String getOuterMethodName()
public String getSignature()
public String getSource()
public String getSuperName()
public boolean hasNoExternalName()
public boolean isAnonymous()
public void visit(int version, int access, String name, String signature, String superName, String[] interfaces)
visit
in class ClassVisitor
version
- classfile version (ie, Opcodes.V1_5 etc)access
- access flags (ie, bitwise or of Opcodes.ACC_*)name
- internal name of this class (ie, com/google/Foo)signature
- generic signature or nullsuperName
- binary name of superclass (ie, java/lang/Object)interfaces
- array of binary names of implemented interfacespublic AnnotationVisitor visitAnnotation(String desc, boolean visible)
ClassVisitor
visitAnnotation
in class EmptyVisitor
desc
- the class descriptor of the annotation class.visible
- true if the annotation is visible at runtime.public FieldVisitor visitField(int access, String name, String desc, String signature, Object value)
visitField
in class EmptyVisitor
access
- access flags for fieldname
- field namedesc
- type descriptor (ie, Ljava/lang/String;)signature
- generic signature (null if not generic)value
- initialized value if constantpublic void visitInnerClass(String name, String outerName, String innerName, int access)
visitInnerClass
in class ClassVisitor
name
- internal name of inner class (ie, com/google/Foo$1)outerName
- internal name of enclosing class (null if not a member
class or anonymous)innerName
- simple name of the inner class (null if anonymous)access
- access flags (bitwise or of Opcodes.ACC_*) as declared in the
enclosing classpublic 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.visitMethod
in class EmptyVisitor
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 void visitOuterClass(String owner, String name, String desc)
ClassVisitor
visitOuterClass
in class ClassVisitor
owner
- internal name of the enclosing class of the class.name
- the name of the method that contains the class, or
null if the class is not enclosed in a method of its
enclosing class.desc
- the descriptor of the method that contains the class, or
null if the class is not enclosed in a method of its
enclosing class.public void visitSource(String source, String debug)
visitSource
in class ClassVisitor
source
- unqualified filename containing source (ie, Foo.java)debug
- additional debug information (may be null)Copyright © 2018. All rights reserved.