Package net.bytebuddy.asm
Class MemberSubstitution.Substitution.ForFieldAccess
java.lang.Object
net.bytebuddy.asm.MemberSubstitution.Substitution.ForFieldAccess
- All Implemented Interfaces:
MemberSubstitution.Substitution
- Enclosing interface:
MemberSubstitution.Substitution
@Enhance
public static class MemberSubstitution.Substitution.ForFieldAccess
extends Object
implements MemberSubstitution.Substitution
A substitution with a field access.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceA method resolver for locating a field for a substitute.static classA factory for a substitution that substitutes with a given field.static classA factory for a substitution that locates a field on the receiver type using a matcher.Nested classes/interfaces inherited from interface net.bytebuddy.asm.MemberSubstitution.Substitution
MemberSubstitution.Substitution.Chain, MemberSubstitution.Substitution.Factory, MemberSubstitution.Substitution.ForFieldAccess, MemberSubstitution.Substitution.ForMethodInvocation, MemberSubstitution.Substitution.ForValue, MemberSubstitution.Substitution.Stubbing -
Field Summary
FieldsModifier and TypeFieldDescriptionA resolver to locate the field to access.private final TypeDescriptionThe instrumented type. -
Constructor Summary
ConstructorsConstructorDescriptionForFieldAccess(TypeDescription instrumentedType, MemberSubstitution.Substitution.ForFieldAccess.FieldResolver fieldResolver) Creates a new substitution with a field access. -
Method Summary
Modifier and TypeMethodDescriptionresolve(TypeDescription receiver, ByteCodeElement.Member original, TypeList.Generic parameters, TypeDescription.Generic result, JavaConstant.MethodHandle methodHandle, StackManipulation stackManipulation, int freeOffset) Resolves this substitution into a stack manipulation.
-
Field Details
-
instrumentedType
The instrumented type. -
fieldResolver
A resolver to locate the field to access.
-
-
Constructor Details
-
ForFieldAccess
public ForFieldAccess(TypeDescription instrumentedType, MemberSubstitution.Substitution.ForFieldAccess.FieldResolver fieldResolver) Creates a new substitution with a field access.- Parameters:
instrumentedType- The instrumented type.fieldResolver- A resolver to locate the field to access.
-
-
Method Details
-
resolve
public StackManipulation resolve(TypeDescription receiver, ByteCodeElement.Member original, TypeList.Generic parameters, TypeDescription.Generic result, JavaConstant.MethodHandle methodHandle, StackManipulation stackManipulation, int freeOffset) Resolves this substitution into a stack manipulation.- Specified by:
resolvein interfaceMemberSubstitution.Substitution- Parameters:
receiver- The target type on which a member is accessed.original- The field, method or constructor that is substituted.parameters- All parameters that serve as input to this access.result- The result that is expected from the interaction orvoidif no result is expected.methodHandle- A method handle describing the substituted expression.stackManipulation- The original byte code expression that is being executed.freeOffset- The first free offset of the local variable array that can be used for storing values.- Returns:
- A stack manipulation that represents the access.
-