Package net.bytebuddy.utility.visitor
Class MetadataAwareClassVisitor
- java.lang.Object
-
- org.objectweb.asm.ClassVisitor
-
- net.bytebuddy.utility.visitor.MetadataAwareClassVisitor
-
- Direct Known Subclasses:
TypeWriter.Default.ForCreation.CreationClassVisitor,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.
-
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 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 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 value)An order-sensitive invocation ofClassVisitor.visitField(int, String, String, String, Object).protected voidonVisitInnerClass(java.lang.String internalName, 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 value)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.
-
triggerOuterClass
private boolean triggerOuterClass
trueif the outer class was not yet visited.
-
triggerAttributes
private boolean triggerAttributes
trueif the attribute visitation is not yet completed.
-
-
Method Detail
-
onNestHost
protected void onNestHost()
Invoked if the nest host was not visited.
-
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.
-
considerTriggerNestHost
private void considerTriggerNestHost()
Considers triggering a nest host visitation.
-
considerTriggerOuterClass
private void considerTriggerOuterClass()
Considers triggering an outer class visitation.
-
considerTriggerAfterAttributes
private void considerTriggerAfterAttributes()
Considers triggering the after attribute 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.
-
visitOuterClass
public final void visitOuterClass(java.lang.String owner, @MaybeNull java.lang.String name, @MaybeNull java.lang.String descriptor)- Overrides:
visitOuterClassin classorg.objectweb.asm.ClassVisitor
-
onVisitOuterClass
protected void onVisitOuterClass(java.lang.String owner, @MaybeNull java.lang.String name, @MaybeNull 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.
-
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.
-
visitRecordComponent
@MaybeNull public org.objectweb.asm.RecordComponentVisitor visitRecordComponent(java.lang.String name, java.lang.String descriptor, @MaybeNull java.lang.String signature)
- Overrides:
visitRecordComponentin classorg.objectweb.asm.ClassVisitor
-
onVisitRecordComponent
@MaybeNull protected org.objectweb.asm.RecordComponentVisitor onVisitRecordComponent(java.lang.String name, java.lang.String descriptor, @MaybeNull 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
@MaybeNull public final org.objectweb.asm.AnnotationVisitor visitAnnotation(java.lang.String descriptor, boolean visible)
- Overrides:
visitAnnotationin classorg.objectweb.asm.ClassVisitor
-
onVisitAnnotation
@MaybeNull 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
@MaybeNull 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
@MaybeNull 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, @MaybeNull java.lang.String outerName, @MaybeNull java.lang.String innerName, int modifiers)- Overrides:
visitInnerClassin classorg.objectweb.asm.ClassVisitor
-
onVisitInnerClass
protected void onVisitInnerClass(java.lang.String internalName, @MaybeNull java.lang.String outerName, @MaybeNull java.lang.String innerName, int modifiers)An order-sensitive invocation ofClassVisitor.visitInnerClass(String, String, String, int).- Parameters:
internalName- The internal name of the inner class.outerName- The internal name of the outer class ornullfor a member class.innerName- The inner class's simple name ornullfor an anonymous class.modifiers- The inner class's source code modifiers.
-
visitField
@MaybeNull public final org.objectweb.asm.FieldVisitor visitField(int modifiers, java.lang.String internalName, java.lang.String descriptor, @MaybeNull java.lang.String signature, @MaybeNull java.lang.Object value)
- Overrides:
visitFieldin classorg.objectweb.asm.ClassVisitor
-
onVisitField
@MaybeNull protected org.objectweb.asm.FieldVisitor onVisitField(int modifiers, java.lang.String internalName, java.lang.String descriptor, @MaybeNull java.lang.String signature, @MaybeNull java.lang.Object value)
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.value- The field's default value ornullif no such value exists.- Returns:
- A field visitor to visit the field or
nullto ignore it.
-
visitMethod
@MaybeNull public final org.objectweb.asm.MethodVisitor visitMethod(int modifiers, java.lang.String internalName, java.lang.String descriptor, @MaybeNull java.lang.String signature, @MaybeNull java.lang.String[] exception)
- Overrides:
visitMethodin classorg.objectweb.asm.ClassVisitor
-
onVisitMethod
@MaybeNull protected org.objectweb.asm.MethodVisitor onVisitMethod(int modifiers, java.lang.String internalName, java.lang.String descriptor, @MaybeNull java.lang.String signature, @MaybeNull 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().
-
-