Package net.bytebuddy.utility.visitor
Class MetadataAwareClassVisitor
- java.lang.Object
-
- org.objectweb.asm.ClassVisitor
-
- net.bytebuddy.utility.visitor.MetadataAwareClassVisitor
-
- Direct Known Subclasses:
TypeWriter.Default.ForInlining.WithDecorationOnly.DecorationClassVisitor,TypeWriter.Default.ForInlining.WithFullProcessing.RedefinitionClassVisitor
public abstract class MetadataAwareClassVisitor extends org.objectweb.asm.ClassVisitorA class visitor that traces invocations of visitation methods and notifies if a nest host or outer class was not visited.
-
-
Field Summary
Fields Modifier and Type Field Description private booleantriggerAttributestrueif the attribute visitation is not yet completed.private booleantriggerNestHosttrueif the nest host was not yet visited.private booleantriggerOuterClasstrueif the outer class was not yet visited.private booleantriggerPermittedSubclassestrueif the permitted subclass visitation is not yet completed.private booleantriggerRecordComponentstrueif the record component visitation is not yet triggered.
-
Constructor Summary
Constructors Modifier Constructor Description protectedMetadataAwareClassVisitor(int api, org.objectweb.asm.ClassVisitor classVisitor)Creates a metadata aware class visitor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidconsiderTriggerAfterAttributes()Considers triggering the after attribute visitation.private voidconsiderTriggerAfterPermittedSubclasses()Considers triggering the after permitted subclass visitation.private voidconsiderTriggerAfterRecordComponents()Considers triggering the after record components visitation.private voidconsiderTriggerNestHost()Considers triggering a nest host visitation.private voidconsiderTriggerOuterClass()Considers triggering an outer class visitation.protected voidonAfterAttributes()Invoked if the attribute visitation is about to complete.protected voidonAfterPermittedSubclasses()Invoked if the permitted subclass visitation is about to complete.protected voidonAfterRecordComponents()Invoked after all record components are visited or none is found.protected voidonNestHost()Invoked if the nest host was not visited.protected voidonOuterType()Invoked if the outer class was not visited.protected org.objectweb.asm.AnnotationVisitoronVisitAnnotation(java.lang.String descriptor, boolean visible)An order-sensitive invocation ofClassVisitor.visitAnnotation(String, boolean).protected voidonVisitAttribute(org.objectweb.asm.Attribute attribute)An order-sensitive invocation ofClassVisitor.visitAttribute(Attribute).protected voidonVisitEnd()An order-sensitive invocation ofClassVisitor.visitEnd().protected org.objectweb.asm.FieldVisitoronVisitField(int modifiers, java.lang.String internalName, java.lang.String descriptor, java.lang.String signature, java.lang.Object defaultValue)An order-sensitive invocation ofClassVisitor.visitField(int, String, String, String, Object).protected voidonVisitInnerClass(java.lang.String name, java.lang.String outerName, java.lang.String innerName, int modifiers)An order-sensitive invocation ofClassVisitor.visitInnerClass(String, String, String, int).protected org.objectweb.asm.MethodVisitoronVisitMethod(int modifiers, java.lang.String internalName, java.lang.String descriptor, java.lang.String signature, java.lang.String[] exception)An order-sensitive invocation ofClassVisitor.visitMethod(int, String, String, String, String[]).protected voidonVisitNestHost(java.lang.String nestHost)An order-sensitive invocation ofClassVisitor.visitNestHost(String).protected voidonVisitNestMember(java.lang.String nestMember)An order-sensitive invocation ofClassVisitor.visitNestMember(String).protected voidonVisitOuterClass(java.lang.String owner, java.lang.String name, java.lang.String descriptor)An order-sensitive invocation ofClassVisitor.visitOuterClass(String, String, String).protected voidonVisitPermittedSubclass(java.lang.String permittedSubclass)An order-sensitive invocation ofClassVisitor#visitPermittedSubclass.protected org.objectweb.asm.RecordComponentVisitoronVisitRecordComponent(java.lang.String name, java.lang.String descriptor, java.lang.String signature)An order-sensitive invocation ofClassVisitor.visitRecordComponent(String, String, String).protected org.objectweb.asm.AnnotationVisitoronVisitTypeAnnotation(int typeReference, org.objectweb.asm.TypePath typePath, java.lang.String descriptor, boolean visible)An order-sensitive invocation ofClassVisitor.visitTypeAnnotation(int, TypePath, String, boolean).org.objectweb.asm.AnnotationVisitorvisitAnnotation(java.lang.String descriptor, boolean visible)voidvisitAttribute(org.objectweb.asm.Attribute attribute)voidvisitEnd()org.objectweb.asm.FieldVisitorvisitField(int modifiers, java.lang.String internalName, java.lang.String descriptor, java.lang.String signature, java.lang.Object defaultValue)voidvisitInnerClass(java.lang.String name, java.lang.String outerName, java.lang.String innerName, int modifiers)org.objectweb.asm.MethodVisitorvisitMethod(int modifiers, java.lang.String internalName, java.lang.String descriptor, java.lang.String signature, java.lang.String[] exception)voidvisitNestHost(java.lang.String nestHost)voidvisitNestMember(java.lang.String nestMember)voidvisitOuterClass(java.lang.String owner, java.lang.String name, java.lang.String descriptor)voidvisitPermittedSubclass(java.lang.String permittedSubclass)org.objectweb.asm.RecordComponentVisitorvisitRecordComponent(java.lang.String name, java.lang.String descriptor, java.lang.String signature)org.objectweb.asm.AnnotationVisitorvisitTypeAnnotation(int typeReference, org.objectweb.asm.TypePath typePath, java.lang.String descriptor, boolean visible)
-
-
-
Field Detail
-
triggerNestHost
private boolean triggerNestHost
trueif the nest host was not yet visited.
-
triggerPermittedSubclasses
private boolean triggerPermittedSubclasses
trueif the permitted subclass visitation is not yet completed.
-
triggerOuterClass
private boolean triggerOuterClass
trueif the outer class was not yet visited.
-
triggerAttributes
private boolean triggerAttributes
trueif the attribute visitation is not yet completed.
-
triggerRecordComponents
private boolean triggerRecordComponents
trueif the record component visitation is not yet triggered.
-
-
Method Detail
-
onNestHost
protected void onNestHost()
Invoked if the nest host was not visited.
-
onAfterPermittedSubclasses
protected void onAfterPermittedSubclasses()
Invoked if the permitted subclass visitation is about to complete.
-
onOuterType
protected void onOuterType()
Invoked if the outer class was not visited.
-
onAfterAttributes
protected void onAfterAttributes()
Invoked if the attribute visitation is about to complete.
-
onAfterRecordComponents
protected void onAfterRecordComponents()
Invoked after all record components are visited or none is found.
-
considerTriggerNestHost
private void considerTriggerNestHost()
Considers triggering a nest host visitation.
-
considerTriggerOuterClass
private void considerTriggerOuterClass()
Considers triggering an outer class visitation.
-
considerTriggerAfterPermittedSubclasses
private void considerTriggerAfterPermittedSubclasses()
Considers triggering the after permitted subclass visitation.
-
considerTriggerAfterAttributes
private void considerTriggerAfterAttributes()
Considers triggering the after attribute visitation.
-
considerTriggerAfterRecordComponents
private void considerTriggerAfterRecordComponents()
Considers triggering the after record components visitation.
-
visitNestHost
public final void visitNestHost(java.lang.String nestHost)
- Overrides:
visitNestHostin classorg.objectweb.asm.ClassVisitor
-
onVisitNestHost
protected void onVisitNestHost(java.lang.String nestHost)
An order-sensitive invocation ofClassVisitor.visitNestHost(String).- Parameters:
nestHost- The internal name of the nest host.
-
visitPermittedSubclass
public final void visitPermittedSubclass(java.lang.String permittedSubclass)
- Overrides:
visitPermittedSubclassin classorg.objectweb.asm.ClassVisitor
-
onVisitPermittedSubclass
protected void onVisitPermittedSubclass(java.lang.String permittedSubclass)
An order-sensitive invocation ofClassVisitor#visitPermittedSubclass.- Parameters:
permittedSubclass- The internal name of the permitted subclass.
-
visitOuterClass
public final void visitOuterClass(java.lang.String owner, java.lang.String name, java.lang.String descriptor)- Overrides:
visitOuterClassin classorg.objectweb.asm.ClassVisitor
-
onVisitOuterClass
protected void onVisitOuterClass(java.lang.String owner, java.lang.String name, java.lang.String descriptor)An order-sensitive invocation ofClassVisitor.visitOuterClass(String, String, String).- Parameters:
owner- The outer class's internal name.name- The outer method's name ornullif it does not exist.descriptor- The outer method's descriptor ornullif it does not exist.
-
visitRecordComponent
public org.objectweb.asm.RecordComponentVisitor visitRecordComponent(java.lang.String name, java.lang.String descriptor, java.lang.String signature)- Overrides:
visitRecordComponentin classorg.objectweb.asm.ClassVisitor
-
onVisitRecordComponent
protected org.objectweb.asm.RecordComponentVisitor onVisitRecordComponent(java.lang.String name, java.lang.String descriptor, java.lang.String signature)An order-sensitive invocation ofClassVisitor.visitRecordComponent(String, String, String).- Parameters:
name- The record component's name.descriptor- The record component's descriptor.signature- The record component's generic signature ornullif the record component's type is non-generic.- Returns:
- The record component visitor or
nullif the component should not be visited.
-
visitAnnotation
public final org.objectweb.asm.AnnotationVisitor visitAnnotation(java.lang.String descriptor, boolean visible)- Overrides:
visitAnnotationin classorg.objectweb.asm.ClassVisitor
-
onVisitAnnotation
protected org.objectweb.asm.AnnotationVisitor onVisitAnnotation(java.lang.String descriptor, boolean visible)An order-sensitive invocation ofClassVisitor.visitAnnotation(String, boolean).- Parameters:
descriptor- The annotation type's descriptor.visible-trueif the annotation is visible at runtime.- Returns:
- An annotation visitor or
nullif the annotation should be ignored.
-
visitTypeAnnotation
public final org.objectweb.asm.AnnotationVisitor visitTypeAnnotation(int typeReference, org.objectweb.asm.TypePath typePath, java.lang.String descriptor, boolean visible)- Overrides:
visitTypeAnnotationin classorg.objectweb.asm.ClassVisitor
-
onVisitTypeAnnotation
protected org.objectweb.asm.AnnotationVisitor onVisitTypeAnnotation(int typeReference, org.objectweb.asm.TypePath typePath, java.lang.String descriptor, boolean visible)An order-sensitive invocation ofClassVisitor.visitTypeAnnotation(int, TypePath, String, boolean).- Parameters:
typeReference- The type reference of the type annotation.typePath- The type path of the type annotation.descriptor- The descriptor of the annotation type.visible-trueif the annotation is visible at runtime.- Returns:
- An annotation visitor or
nullif the annotation should be ignored.
-
visitAttribute
public final void visitAttribute(org.objectweb.asm.Attribute attribute)
- Overrides:
visitAttributein classorg.objectweb.asm.ClassVisitor
-
onVisitAttribute
protected void onVisitAttribute(org.objectweb.asm.Attribute attribute)
An order-sensitive invocation ofClassVisitor.visitAttribute(Attribute).- Parameters:
attribute- The attribute to visit.
-
visitNestMember
public final void visitNestMember(java.lang.String nestMember)
- Overrides:
visitNestMemberin classorg.objectweb.asm.ClassVisitor
-
onVisitNestMember
protected void onVisitNestMember(java.lang.String nestMember)
An order-sensitive invocation ofClassVisitor.visitNestMember(String).- Parameters:
nestMember- The internal name of the nest member.
-
visitInnerClass
public final void visitInnerClass(java.lang.String name, java.lang.String outerName, java.lang.String innerName, int modifiers)- Overrides:
visitInnerClassin classorg.objectweb.asm.ClassVisitor
-
onVisitInnerClass
protected void onVisitInnerClass(java.lang.String name, java.lang.String outerName, java.lang.String innerName, int modifiers)An order-sensitive invocation ofClassVisitor.visitInnerClass(String, String, String, int).- Parameters:
name- The internal name of the inner class.outerName- The internal name of the outer class.innerName- The inner class's simple name ornullfor an anonymous class.modifiers- The inner class's source code modifiers.
-
visitField
public final org.objectweb.asm.FieldVisitor visitField(int modifiers, java.lang.String internalName, java.lang.String descriptor, java.lang.String signature, java.lang.Object defaultValue)- Overrides:
visitFieldin classorg.objectweb.asm.ClassVisitor
-
onVisitField
protected org.objectweb.asm.FieldVisitor onVisitField(int modifiers, java.lang.String internalName, java.lang.String descriptor, java.lang.String signature, java.lang.Object defaultValue)An order-sensitive invocation ofClassVisitor.visitField(int, String, String, String, Object).- Parameters:
modifiers- The field's modifiers.internalName- The field's internal name.descriptor- The field type's descriptor.signature- The field's generic signature ornullif the field is not generic.defaultValue- The field's default value ornullif no such value exists.- Returns:
- A field visitor to visit the field or
nullto ignore it.
-
visitMethod
public final org.objectweb.asm.MethodVisitor visitMethod(int modifiers, java.lang.String internalName, java.lang.String descriptor, java.lang.String signature, java.lang.String[] exception)- Overrides:
visitMethodin classorg.objectweb.asm.ClassVisitor
-
onVisitMethod
protected org.objectweb.asm.MethodVisitor onVisitMethod(int modifiers, java.lang.String internalName, java.lang.String descriptor, java.lang.String signature, java.lang.String[] exception)An order-sensitive invocation ofClassVisitor.visitMethod(int, String, String, String, String[]).- Parameters:
modifiers- The method's modifiers.internalName- The method's internal name.descriptor- The field type's descriptor.signature- The method's generic signature ornullif the method is not generic.exception- The method's declared exceptions ornullif no exceptions are declared.- Returns:
- A method visitor to visit the method or
nullto ignore it.
-
visitEnd
public final void visitEnd()
- Overrides:
visitEndin classorg.objectweb.asm.ClassVisitor
-
onVisitEnd
protected void onVisitEnd()
An order-sensitive invocation ofClassVisitor.visitEnd().
-
-