Package net.bytebuddy.asm
Class MemberSubstitution.Substitution.ForMethodInvocation
java.lang.Object
net.bytebuddy.asm.MemberSubstitution.Substitution.ForMethodInvocation
- All Implemented Interfaces:
MemberSubstitution.Substitution
- Enclosing interface:
- MemberSubstitution.Substitution
@Enhance
public static class MemberSubstitution.Substitution.ForMethodInvocation
extends Object
implements MemberSubstitution.Substitution
A substitution with a method invocation.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface
A method resolver for locating a method for a substitute.static class
A factory for a substitution that invokes a given method.(package private) static enum
A factory for a substitution that invokes the instrumented method.static class
A factory for a substitution that locates a method 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.Stubbing
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final TypeDescription
The instrumented type.The method resolver to use.private static final int
The index of the this reference within a non-static method. -
Constructor Summary
ConstructorsConstructorDescriptionForMethodInvocation
(TypeDescription instrumentedType, MemberSubstitution.Substitution.ForMethodInvocation.MethodResolver methodResolver) Creates a new method-resolving substitution. -
Method Summary
Modifier and TypeMethodDescriptionresolve
(TypeDescription targetType, ByteCodeElement target, TypeList.Generic parameters, TypeDescription.Generic result, int freeOffset) Resolves this substitution into a stack manipulation.
-
Field Details
-
THIS_REFERENCE
private static final int THIS_REFERENCEThe index of the this reference within a non-static method.- See Also:
-
instrumentedType
The instrumented type. -
methodResolver
The method resolver to use.
-
-
Constructor Details
-
ForMethodInvocation
public ForMethodInvocation(TypeDescription instrumentedType, MemberSubstitution.Substitution.ForMethodInvocation.MethodResolver methodResolver) Creates a new method-resolving substitution.- Parameters:
instrumentedType
- The instrumented type.methodResolver
- The method resolver to use.
-
-
Method Details
-
resolve
public StackManipulation resolve(TypeDescription targetType, ByteCodeElement target, TypeList.Generic parameters, TypeDescription.Generic result, int freeOffset) Resolves this substitution into a stack manipulation.- Specified by:
resolve
in interfaceMemberSubstitution.Substitution
- Parameters:
targetType
- The target type on which a member is accessed.target
- The target 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.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.
-