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.ClassVisitor
A class visitor that traces invocations of visitation methods and notifies if a nest host or outer class was not visited.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleantrueif the attribute visitation is not yet completed.private booleantrueif the nest host was not yet visited.private booleantrueif the outer class was not yet visited.Fields inherited from class org.objectweb.asm.ClassVisitor
api, cv -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedMetadataAwareClassVisitor(int api, org.objectweb.asm.ClassVisitor classVisitor) Creates a metadata aware class visitor. -
Method Summary
Modifier and TypeMethodDescriptionprivate voidConsiders triggering the after attribute visitation.private voidConsiders triggering a nest host visitation.private voidConsiders triggering an outer class visitation.protected voidInvoked if the attribute visitation is about to complete.protected voidInvoked if the nest host was not visited.protected voidInvoked if the outer class was not visited.protected org.objectweb.asm.AnnotationVisitoronVisitAnnotation(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 voidAn order-sensitive invocation ofClassVisitor.visitEnd().protected org.objectweb.asm.FieldVisitoronVisitField(int modifiers, String internalName, String descriptor, String signature, Object value) An order-sensitive invocation ofClassVisitor.visitField(int, String, String, String, Object).protected voidonVisitInnerClass(String internalName, String outerName, String innerName, int modifiers) An order-sensitive invocation ofClassVisitor.visitInnerClass(String, String, String, int).protected org.objectweb.asm.MethodVisitoronVisitMethod(int modifiers, String internalName, String descriptor, String signature, String[] exception) An order-sensitive invocation ofClassVisitor.visitMethod(int, String, String, String, String[]).protected voidonVisitNestHost(String nestHost) An order-sensitive invocation ofClassVisitor.visitNestHost(String).protected voidonVisitNestMember(String nestMember) An order-sensitive invocation ofClassVisitor.visitNestMember(String).protected voidonVisitOuterClass(String owner, String name, String descriptor) An order-sensitive invocation ofClassVisitor.visitOuterClass(String, String, String).protected voidonVisitPermittedSubclass(String permittedSubclass) An order-sensitive invocation ofClassVisitor#visitPermittedSubclass.protected org.objectweb.asm.RecordComponentVisitoronVisitRecordComponent(String name, String descriptor, String signature) An order-sensitive invocation ofClassVisitor.visitRecordComponent(String, String, String).protected org.objectweb.asm.AnnotationVisitoronVisitTypeAnnotation(int typeReference, org.objectweb.asm.TypePath typePath, String descriptor, boolean visible) An order-sensitive invocation ofClassVisitor.visitTypeAnnotation(int, TypePath, String, boolean).final org.objectweb.asm.AnnotationVisitorvisitAnnotation(String descriptor, boolean visible) final voidvisitAttribute(org.objectweb.asm.Attribute attribute) final voidvisitEnd()final org.objectweb.asm.FieldVisitorvisitField(int modifiers, String internalName, String descriptor, String signature, Object value) final voidvisitInnerClass(String name, String outerName, String innerName, int modifiers) final org.objectweb.asm.MethodVisitorvisitMethod(int modifiers, String internalName, String descriptor, String signature, String[] exception) final voidvisitNestHost(String nestHost) final voidvisitNestMember(String nestMember) final voidvisitOuterClass(String owner, String name, String descriptor) final voidvisitPermittedSubclass(String permittedSubclass) org.objectweb.asm.RecordComponentVisitorvisitRecordComponent(String name, String descriptor, String signature) final org.objectweb.asm.AnnotationVisitorvisitTypeAnnotation(int typeReference, org.objectweb.asm.TypePath typePath, String descriptor, boolean visible) Methods inherited from class org.objectweb.asm.ClassVisitor
getDelegate, visit, visitModule, visitSource
-
Field Details
-
triggerNestHost
private boolean triggerNestHosttrueif the nest host was not yet visited. -
triggerOuterClass
private boolean triggerOuterClasstrueif the outer class was not yet visited. -
triggerAttributes
private boolean triggerAttributestrueif the attribute visitation is not yet completed.
-
-
Constructor Details
-
MetadataAwareClassVisitor
protected MetadataAwareClassVisitor(int api, org.objectweb.asm.ClassVisitor classVisitor) Creates a metadata aware class visitor.- Parameters:
api- The API version.classVisitor- The class visitor to delegate to.
-
-
Method Details
-
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
- Overrides:
visitNestHostin classorg.objectweb.asm.ClassVisitor
-
onVisitNestHost
An order-sensitive invocation ofClassVisitor.visitNestHost(String).- Parameters:
nestHost- The internal name of the nest host.
-
visitOuterClass
public final void visitOuterClass(String owner, @MaybeNull String name, @MaybeNull String descriptor) - Overrides:
visitOuterClassin classorg.objectweb.asm.ClassVisitor
-
onVisitOuterClass
protected void onVisitOuterClass(String owner, @MaybeNull String name, @MaybeNull 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
- Overrides:
visitPermittedSubclassin classorg.objectweb.asm.ClassVisitor
-
onVisitPermittedSubclass
An order-sensitive invocation ofClassVisitor#visitPermittedSubclass.- Parameters:
permittedSubclass- The internal name of the permitted subclass.
-
visitRecordComponent
@MaybeNull public org.objectweb.asm.RecordComponentVisitor visitRecordComponent(String name, String descriptor, @MaybeNull String signature) - Overrides:
visitRecordComponentin classorg.objectweb.asm.ClassVisitor
-
onVisitRecordComponent
@MaybeNull protected org.objectweb.asm.RecordComponentVisitor onVisitRecordComponent(String name, String descriptor, @MaybeNull 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(String descriptor, boolean visible) - Overrides:
visitAnnotationin classorg.objectweb.asm.ClassVisitor
-
onVisitAnnotation
@MaybeNull protected org.objectweb.asm.AnnotationVisitor onVisitAnnotation(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, 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, 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
- Overrides:
visitNestMemberin classorg.objectweb.asm.ClassVisitor
-
onVisitNestMember
An order-sensitive invocation ofClassVisitor.visitNestMember(String).- Parameters:
nestMember- The internal name of the nest member.
-
visitInnerClass
public final void visitInnerClass(String name, @MaybeNull String outerName, @MaybeNull String innerName, int modifiers) - Overrides:
visitInnerClassin classorg.objectweb.asm.ClassVisitor
-
onVisitInnerClass
protected void onVisitInnerClass(String internalName, @MaybeNull String outerName, @MaybeNull 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, String internalName, String descriptor, @MaybeNull String signature, @MaybeNull Object value) - Overrides:
visitFieldin classorg.objectweb.asm.ClassVisitor
-
onVisitField
@MaybeNull protected org.objectweb.asm.FieldVisitor onVisitField(int modifiers, String internalName, String descriptor, @MaybeNull String signature, @MaybeNull 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, String internalName, String descriptor, @MaybeNull String signature, @MaybeNull String[] exception) - Overrides:
visitMethodin classorg.objectweb.asm.ClassVisitor
-
onVisitMethod
@MaybeNull protected org.objectweb.asm.MethodVisitor onVisitMethod(int modifiers, String internalName, String descriptor, @MaybeNull String signature, @MaybeNull 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().
-