Package net.bytebuddy.asm
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 aAsmVisitorWrapper.ForDeclaredFields.FieldVisitorWrapper
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
AsmVisitorWrapper.ForDeclaredFields.DispatchingVisitor
A class visitor that applies the outer ASM visitor for identifying declared fields.protected static class
AsmVisitorWrapper.ForDeclaredFields.Entry
An entry describing a field visitor wrapper paired with a matcher for fields to be wrapped.static interface
AsmVisitorWrapper.ForDeclaredFields.FieldVisitorWrapper
A field visitor wrapper that allows for wrapping aFieldVisitor
defining a declared field.-
Nested classes/interfaces inherited from interface net.bytebuddy.asm.AsmVisitorWrapper
AsmVisitorWrapper.AbstractBase, AsmVisitorWrapper.Compound, AsmVisitorWrapper.ForDeclaredFields, AsmVisitorWrapper.ForDeclaredMethods, AsmVisitorWrapper.NoOp
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<AsmVisitorWrapper.ForDeclaredFields.Entry>
entries
The list of entries that describe matched fields in their application order.-
Fields inherited from interface net.bytebuddy.asm.AsmVisitorWrapper
NO_FLAGS
-
-
Constructor Summary
Constructors Modifier Constructor Description ForDeclaredFields()
Creates a new visitor wrapper for declared fields.protected
ForDeclaredFields(java.util.List<AsmVisitorWrapper.ForDeclaredFields.Entry> entries)
Creates a new visitor wrapper for declared fields.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AsmVisitorWrapper.ForDeclaredFields
field(ElementMatcher<? super FieldDescription.InDefinedShape> matcher, java.util.List<? extends AsmVisitorWrapper.ForDeclaredFields.FieldVisitorWrapper> fieldVisitorWrappers)
Defines a new field visitor wrapper to be applied if the given field matcher is matched.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.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 aClassVisitorWrapper
to the creation of aDynamicType
.-
Methods inherited from class net.bytebuddy.asm.AsmVisitorWrapper.AbstractBase
mergeReader, mergeWriter
-
-
-
-
Field Detail
-
entries
private final java.util.List<AsmVisitorWrapper.ForDeclaredFields.Entry> entries
The list of entries that describe matched fields in their application order.
-
-
Constructor Detail
-
ForDeclaredFields
public ForDeclaredFields()
Creates a new visitor wrapper for declared fields.
-
ForDeclaredFields
protected ForDeclaredFields(java.util.List<AsmVisitorWrapper.ForDeclaredFields.Entry> entries)
Creates a new visitor wrapper for declared fields.- Parameters:
entries
- The list of entries that describe matched fields in their application order.
-
-
Method Detail
-
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, java.util.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 aClassVisitorWrapper
to the creation of aDynamicType
.- Parameters:
instrumentedType
- The instrumented type.classVisitor
- AClassVisitor
to become the new primary class visitor to which the createdDynamicType
is 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 ASMClassWriter
flags to consider.readerFlags
- The ASMClassReader
flags to consider.- Returns:
- A new
ClassVisitor
that usually delegates to theClassVisitor
delivered in the argument.
-
-