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 interface
A method resolver for locating a field for a substitute.static class
A factory for a substitution that substitutes with a given field.static class
A 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 TypeDescription
The 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
(MemberSubstitution.Target target, 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(MemberSubstitution.Target target, TypeList.Generic parameters, TypeDescription.Generic result, JavaConstant.MethodHandle methodHandle, StackManipulation stackManipulation, int freeOffset) Resolves this substitution into a stack manipulation.- Specified by:
resolve
in interfaceMemberSubstitution.Substitution
- Parameters:
target
- The target member of invokedynamic invocation.parameters
- All parameters that serve as input to this access.result
- The result that is expected from the interaction orvoid
if 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.
-