Package net.bytebuddy.implementation
Class MethodCall.TargetHandler.ForValue
- java.lang.Object
-
- net.bytebuddy.implementation.MethodCall.TargetHandler.ForValue
-
- All Implemented Interfaces:
InstrumentedType.Prepareable
,MethodCall.TargetHandler
- Enclosing interface:
- MethodCall.TargetHandler
@Enhance public static class MethodCall.TargetHandler.ForValue extends java.lang.Object implements MethodCall.TargetHandler
A target handler that invokes a method on an instance that is stored in a static field.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface net.bytebuddy.implementation.MethodCall.TargetHandler
MethodCall.TargetHandler.ForConstructingInvocation, MethodCall.TargetHandler.ForField, MethodCall.TargetHandler.ForMethodCall, MethodCall.TargetHandler.ForMethodParameter, MethodCall.TargetHandler.ForSelfOrStaticInvocation, MethodCall.TargetHandler.ForValue
-
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.String
FIELD_PREFIX
The name prefix of the field to store the instance.private TypeDescription.Generic
fieldType
The type of the field.private java.lang.String
name
The name of the field to store the target.private java.lang.Object
target
The target on which the method is to be invoked.
-
Constructor Summary
Constructors Modifier Constructor Description protected
ForValue(java.lang.Object target, TypeDescription.Generic fieldType)
Creates a new target handler for a static field.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description InstrumentedType
prepare(InstrumentedType instrumentedType)
Prepares a given instrumented type.TypeDescription
resolve(TypeDescription instrumentedType, MethodDescription instrumentedMethod)
Resolves the method call's target.StackManipulation
resolve(Implementation.Target implementationTarget, MethodDescription invokedMethod, MethodDescription instrumentedMethod, TypeDescription instrumentedType, Assigner assigner, Assigner.Typing typing)
Creates a stack manipulation that represents the method's invocation.
-
-
-
Field Detail
-
FIELD_PREFIX
private static final java.lang.String FIELD_PREFIX
The name prefix of the field to store the instance.- See Also:
- Constant Field Values
-
target
private final java.lang.Object target
The target on which the method is to be invoked.
-
fieldType
private final TypeDescription.Generic fieldType
The type of the field.
-
name
@ValueHandling(IGNORE) private final java.lang.String name
The name of the field to store the target.
-
-
Constructor Detail
-
ForValue
protected ForValue(java.lang.Object target, TypeDescription.Generic fieldType)
Creates a new target handler for a static field.- Parameters:
target
- The target on which the method is to be invoked.fieldType
- The type of the field.
-
-
Method Detail
-
resolve
public StackManipulation resolve(Implementation.Target implementationTarget, MethodDescription invokedMethod, MethodDescription instrumentedMethod, TypeDescription instrumentedType, Assigner assigner, Assigner.Typing typing)
Creates a stack manipulation that represents the method's invocation.- Specified by:
resolve
in interfaceMethodCall.TargetHandler
- Parameters:
implementationTarget
- The implementation target.invokedMethod
- The method to be invoked.instrumentedMethod
- The instrumented method.instrumentedType
- The instrumented type. @return A stack manipulation that invokes the method.assigner
- The assigner to use.typing
- The typing to apply.- Returns:
- A stack manipulation that loads the method target onto the operand stack.
-
resolve
public TypeDescription resolve(TypeDescription instrumentedType, MethodDescription instrumentedMethod)
Resolves the method call's target.- Specified by:
resolve
in interfaceMethodCall.TargetHandler
- Parameters:
instrumentedType
- The instrumented type.instrumentedMethod
- The instrumented method.- Returns:
- method call's target
-
prepare
public InstrumentedType prepare(InstrumentedType instrumentedType)
Prepares a given instrumented type.- Specified by:
prepare
in interfaceInstrumentedType.Prepareable
- Parameters:
instrumentedType
- The instrumented type in its current form.- Returns:
- The prepared instrumented type.
-
-