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 java.lang.Object implements MemberSubstitution.Substitution
A substitution with a field access.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
MemberSubstitution.Substitution.ForFieldAccess.FieldResolver
A method resolver for locating a field for a substitute.static class
MemberSubstitution.Substitution.ForFieldAccess.OfGivenField
A factory for a substitution that substitutes with a given field.static class
MemberSubstitution.Substitution.ForFieldAccess.OfMatchedField
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
Fields Modifier and Type Field Description private MemberSubstitution.Substitution.ForFieldAccess.FieldResolver
fieldResolver
A resolver to locate the field to access.private TypeDescription
instrumentedType
The instrumented type.
-
Constructor Summary
Constructors Constructor Description ForFieldAccess(TypeDescription instrumentedType, MemberSubstitution.Substitution.ForFieldAccess.FieldResolver fieldResolver)
Creates a new substitution with a field access.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.
-
-
-
Field Detail
-
instrumentedType
private final TypeDescription instrumentedType
The instrumented type.
-
fieldResolver
private final MemberSubstitution.Substitution.ForFieldAccess.FieldResolver fieldResolver
A resolver to locate the field to access.
-
-
Constructor Detail
-
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 Detail
-
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:
resolve
in 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 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.
-
-