Class AsmVisitorWrapper.ForDeclaredFields
java.lang.Object
net.bytebuddy.asm.AsmVisitorWrapper.AbstractBase
net.bytebuddy.asm.AsmVisitorWrapper.ForDeclaredFields
- All Implemented Interfaces:
AsmVisitorWrapper
- Enclosing interface:
AsmVisitorWrapper
@Enhance
public static class AsmVisitorWrapper.ForDeclaredFields
extends AsmVisitorWrapper.AbstractBase
An ASM visitor wrapper that allows to wrap declared fields of the instrumented type with a
AsmVisitorWrapper.ForDeclaredFields.FieldVisitorWrapper.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected classA class visitor that applies the outer ASM visitor for identifying declared fields.protected static classAn entry describing a field visitor wrapper paired with a matcher for fields to be wrapped.static interfaceA field visitor wrapper that allows for wrapping aFieldVisitordefining a declared field.Nested classes/interfaces inherited from interface AsmVisitorWrapper
AsmVisitorWrapper.AbstractBase, AsmVisitorWrapper.Compound, AsmVisitorWrapper.ForDeclaredFields, AsmVisitorWrapper.ForDeclaredMethods, AsmVisitorWrapper.NoOp -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final List<AsmVisitorWrapper.ForDeclaredFields.Entry> The list of entries that describe matched fields in their application order.Fields inherited from interface AsmVisitorWrapper
NO_FLAGS -
Constructor Summary
ConstructorsModifierConstructorDescriptionCreates a new visitor wrapper for declared fields.protectedCreates a new visitor wrapper for declared fields. -
Method Summary
Modifier and TypeMethodDescriptionfield(ElementMatcher<? super FieldDescription.InDefinedShape> matcher, List<? extends AsmVisitorWrapper.ForDeclaredFields.FieldVisitorWrapper> fieldVisitorWrappers) Defines a new field visitor wrapper to be applied if the given field matcher is matched.field(ElementMatcher<? super FieldDescription.InDefinedShape> matcher, AsmVisitorWrapper.ForDeclaredFields.FieldVisitorWrapper... fieldVisitorWrapper) Defines a new field visitor wrapper to be applied if the given field matcher is matched.org.objectweb.asm.ClassVisitorwrap(TypeDescription instrumentedType, org.objectweb.asm.ClassVisitor classVisitor, Implementation.Context implementationContext, TypePool typePool, FieldList<FieldDescription.InDefinedShape> fields, MethodList<?> methods, int writerFlags, int readerFlags) Applies aClassVisitorWrapperto the creation of aDynamicType.Methods inherited from class AsmVisitorWrapper.AbstractBase
mergeReader, mergeWriter
-
Field Details
-
entries
The list of entries that describe matched fields in their application order.
-
-
Constructor Details
-
ForDeclaredFields
public ForDeclaredFields()Creates a new visitor wrapper for declared fields. -
ForDeclaredFields
Creates a new visitor wrapper for declared fields.- Parameters:
entries- The list of entries that describe matched fields in their application order.
-
-
Method Details
-
field
public AsmVisitorWrapper.ForDeclaredFields field(ElementMatcher<? super FieldDescription.InDefinedShape> matcher, AsmVisitorWrapper.ForDeclaredFields.FieldVisitorWrapper... fieldVisitorWrapper) Defines a new field visitor wrapper to be applied if the given field matcher is matched. Previously defined entries are applied before the given matcher is applied.- Parameters:
matcher- The matcher to identify fields to be wrapped.fieldVisitorWrapper- The field visitor wrapper to be applied if the given matcher is matched.- Returns:
- A new ASM visitor wrapper that applied the given field visitor wrapper if the supplied matcher is matched.
-
field
public AsmVisitorWrapper.ForDeclaredFields field(ElementMatcher<? super FieldDescription.InDefinedShape> matcher, List<? extends AsmVisitorWrapper.ForDeclaredFields.FieldVisitorWrapper> fieldVisitorWrappers) Defines a new field visitor wrapper to be applied if the given field matcher is matched. Previously defined entries are applied before the given matcher is applied.- Parameters:
matcher- The matcher to identify fields to be wrapped.fieldVisitorWrappers- The field visitor wrapper to be applied if the given matcher is matched.- Returns:
- A new ASM visitor wrapper that applied the given field visitor wrapper if the supplied matcher is matched.
-
wrap
public org.objectweb.asm.ClassVisitor wrap(TypeDescription instrumentedType, org.objectweb.asm.ClassVisitor classVisitor, Implementation.Context implementationContext, TypePool typePool, FieldList<FieldDescription.InDefinedShape> fields, MethodList<?> methods, int writerFlags, int readerFlags) Applies aClassVisitorWrapperto the creation of aDynamicType.- Parameters:
instrumentedType- The instrumented type.classVisitor- AClassVisitorto become the new primary class visitor to which the createdDynamicTypeis written to.implementationContext- The implementation context of the current instrumentation.typePool- The type pool that was provided for the class creation.fields- The instrumented type's fields.methods- The instrumented type's methods non-ignored declared and virtually inherited methods.writerFlags- The ASMClassWriterflags to consider.readerFlags- The ASMClassReaderflags to consider.- Returns:
- A new
ClassVisitorthat usually delegates to theClassVisitordelivered in the argument.
-