public class EnhancerClassChecker extends ClassVisitor
Modifier and Type | Field and Description |
---|---|
protected boolean |
enhanced
Flag for whether the class is enhanced.
|
protected ClassEnhancer |
enhancer
Enhancer for the class.
|
protected Set<ClassField> |
fieldsRequired
Set of fields required to be present.
|
protected boolean |
logErrors
Whether to log any errors at error level.
|
protected Set<ClassMethod> |
methodsRequired
Set of methods required to be present.
|
api, cv
Constructor and Description |
---|
EnhancerClassChecker(ClassEnhancer enhancer,
boolean logErrors)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
protected boolean |
hasInterface(String[] interfaces,
String intf)
Convenience method to check if a particular interface is present in the list.
|
boolean |
isEnhanced()
Accessor for whether the class is considered enhanced.
|
protected void |
reportError(String msg)
Convenience method to report an error in the enhancement of this class.
|
void |
visit(int version,
int access,
String name,
String signature,
String supername,
String[] interfaces)
Method to visit the header of the class
|
AnnotationVisitor |
visitAnnotation(String desc,
boolean visible)
Method to visit a class annotations
|
void |
visitAttribute(Attribute attr)
Method to visit a non-standard attribute
|
void |
visitEnd()
Visit the end of the class
|
FieldVisitor |
visitField(int access,
String name,
String desc,
String signature,
Object value)
Visit a field of the class.
|
void |
visitInnerClass(String name,
String outerName,
String innerName,
int access)
Visit an inner class of the class
|
MethodVisitor |
visitMethod(int access,
String name,
String desc,
String signature,
String[] exceptions)
Visit a method of the class
|
void |
visitOuterClass(String owner,
String name,
String desc)
Visit an outer class.
|
void |
visitSource(String source,
String debug)
Visit the source of the class
|
visitModule, visitTypeAnnotation
protected ClassEnhancer enhancer
protected Set<ClassField> fieldsRequired
protected Set<ClassMethod> methodsRequired
protected boolean enhanced
protected boolean logErrors
public EnhancerClassChecker(ClassEnhancer enhancer, boolean logErrors)
enhancer
- The class enhancerlogErrors
- Whether to log any errors at error levelpublic boolean isEnhanced()
protected void reportError(String msg)
msg
- The messagepublic void visit(int version, int access, String name, String signature, String supername, String[] interfaces)
visit
in class ClassVisitor
version
- Version of the class fileaccess
- Access typename
- name of the classsignature
- signature of the classsupername
- superclass nameinterfaces
- interface(s)protected boolean hasInterface(String[] interfaces, String intf)
interfaces
- The list of interfaces implementedintf
- The interface we are looking forpublic AnnotationVisitor visitAnnotation(String desc, boolean visible)
visitAnnotation
in class ClassVisitor
desc
- descriptor of the annotationvisible
- Whether visiblepublic void visitAttribute(Attribute attr)
visitAttribute
in class ClassVisitor
attr
- the attributepublic void visitEnd()
visitEnd
in class ClassVisitor
public FieldVisitor visitField(int access, String name, String desc, String signature, Object value)
visitField
in class ClassVisitor
access
- Access for the fieldname
- name of the fielddesc
- Descriptor of the fieldsignature
- signature of the fieldvalue
- initial valuepublic void visitInnerClass(String name, String outerName, String innerName, int access)
visitInnerClass
in class ClassVisitor
name
- Internal name of the classouterName
- name of the outer classinnerName
- name of the inner classaccess
- access of the inner classpublic MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions)
visitMethod
in class ClassVisitor
access
- Access for the fieldname
- name of the fielddesc
- Descriptor of the fieldsignature
- signature of the fieldexceptions
- Exceptions thrownpublic void visitOuterClass(String owner, String name, String desc)
visitOuterClass
in class ClassVisitor
owner
- owner for the outer classname
- name of the outer classdesc
- Descriptor of the outer classpublic void visitSource(String source, String debug)
visitSource
in class ClassVisitor
source
- name of source filedebug
- debug infoCopyright © 2019. All rights reserved.