Class EnhancerClassChecker
java.lang.Object
org.datanucleus.enhancer.asm.ClassVisitor
org.datanucleus.enhancer.EnhancerClassChecker
Visitor used to check the enhancement state of a class.
Checks the methods/fields present against what is required for enhancement.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanFlag for whether the class is enhanced.protected ClassEnhancerEnhancer for the class.protected Set<ClassField> Set of fields required to be present.protected booleanWhether to log any errors at error level.protected Set<ClassMethod> Set of methods required to be present.Fields inherited from class ClassVisitor
api, cv -
Constructor Summary
ConstructorsConstructorDescriptionEnhancerClassChecker(ClassEnhancer enhancer, boolean logErrors) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanhasInterface(String[] interfaces, String intf) Convenience method to check if a particular interface is present in the list.booleanAccessor for whether the class is considered enhanced.protected voidreportError(String msg) Convenience method to report an error in the enhancement of this class.voidvisit(int version, int access, String name, String signature, String supername, String[] interfaces) Method to visit the header of the classvisitAnnotation(String desc, boolean visible) Method to visit a class annotationsvoidvisitAttribute(Attribute attr) Method to visit a non-standard attributevoidvisitEnd()Visit the end of the classvisitField(int access, String name, String desc, String signature, Object value) Visit a field of the class.voidvisitInnerClass(String name, String outerName, String innerName, int access) Visit an inner class of the classvisitMethod(int access, String name, String desc, String signature, String[] exceptions) Visit a method of the classvoidvisitOuterClass(String owner, String name, String desc) Visit an outer class.voidvisitSource(String source, String debug) Visit the source of the classMethods inherited from class ClassVisitor
getDelegate, visitModule, visitNestHost, visitNestMember, visitPermittedSubclass, visitRecordComponent, visitTypeAnnotation
-
Field Details
-
enhancer
Enhancer for the class. -
fieldsRequired
Set of fields required to be present. -
methodsRequired
Set of methods required to be present. -
enhanced
protected boolean enhancedFlag for whether the class is enhanced. Set in the visit process. -
logErrors
protected boolean logErrorsWhether to log any errors at error level.
-
-
Constructor Details
-
EnhancerClassChecker
Constructor.- Parameters:
enhancer- The class enhancerlogErrors- Whether to log any errors at error level
-
-
Method Details
-
isEnhanced
public boolean isEnhanced()Accessor for whether the class is considered enhanced. Should only be run after passing this class to the reader as a visitor.- Returns:
- Whether the class is enhanced.
-
reportError
Convenience method to report an error in the enhancement of this class.- Parameters:
msg- The message
-
visit
public void visit(int version, int access, String name, String signature, String supername, String[] interfaces) Method to visit the header of the class- Overrides:
visitin classClassVisitor- Parameters:
version- Version of the class fileaccess- Access typename- name of the classsignature- signature of the classsupername- superclass nameinterfaces- interface(s)
-
hasInterface
-
visitAnnotation
Method to visit a class annotations- Overrides:
visitAnnotationin classClassVisitor- Parameters:
desc- descriptor of the annotationvisible- Whether visible- Returns:
- The visitor
-
visitAttribute
Method to visit a non-standard attribute- Overrides:
visitAttributein classClassVisitor- Parameters:
attr- the attribute
-
visitEnd
-
visitField
public FieldVisitor visitField(int access, String name, String desc, String signature, Object value) Visit a field of the class.- Overrides:
visitFieldin classClassVisitor- Parameters:
access- Access for the fieldname- name of the fielddesc- Descriptor of the fieldsignature- signature of the fieldvalue- initial value- Returns:
- The visitor for the field
-
visitInnerClass
Visit an inner class of the class- Overrides:
visitInnerClassin classClassVisitor- Parameters:
name- Internal name of the classouterName- name of the outer classinnerName- name of the inner classaccess- access of the inner class
-
visitMethod
public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) Visit a method of the class- Overrides:
visitMethodin classClassVisitor- Parameters:
access- Access for the fieldname- name of the fielddesc- Descriptor of the fieldsignature- signature of the fieldexceptions- Exceptions thrown- Returns:
- visitor for the method
-
visitOuterClass
Visit an outer class.- Overrides:
visitOuterClassin classClassVisitor- Parameters:
owner- owner for the outer classname- name of the outer classdesc- Descriptor of the outer class
-
visitSource
Visit the source of the class- Overrides:
visitSourcein classClassVisitor- Parameters:
source- name of source filedebug- debug info
-