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 classAsmVisitorWrapper.ForDeclaredFields.DispatchingVisitorA class visitor that applies the outer ASM visitor for identifying declared fields.protected static classAsmVisitorWrapper.ForDeclaredFields.EntryAn entry describing a field visitor wrapper paired with a matcher for fields to be wrapped.static interfaceAsmVisitorWrapper.ForDeclaredFields.FieldVisitorWrapperA field visitor wrapper that allows for wrapping aFieldVisitordefining 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>entriesThe 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.protectedForDeclaredFields(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.ForDeclaredFieldsfield(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.ForDeclaredFieldsfield(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 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 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.
-
-