Package net.bytebuddy.implementation
Class MethodCall.TerminationHandler.FieldSetting
java.lang.Object
net.bytebuddy.implementation.MethodCall.TerminationHandler.FieldSetting
- All Implemented Interfaces:
MethodCall.TerminationHandler
- Enclosing interface:
- MethodCall.TerminationHandler
@Enhance
public static class MethodCall.TerminationHandler.FieldSetting
extends Object
implements MethodCall.TerminationHandler
A termination handler that sets a field.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static class
A factory for a field-setting termination handler that locates a given field.protected static class
A factory for a field-setting termination handler that uses a matcher to locate the target field on the insturmented type.Nested classes/interfaces inherited from interface net.bytebuddy.implementation.MethodCall.TerminationHandler
MethodCall.TerminationHandler.Factory, MethodCall.TerminationHandler.FieldSetting, MethodCall.TerminationHandler.Simple
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
FieldSetting
(FieldDescription fieldDescription) Creates a new field-setting termination handler. -
Method Summary
Modifier and TypeMethodDescriptionprepare()
Returns a preparing stack manipulation to apply prior to the method call.toStackManipulation
(MethodDescription invokedMethod, MethodDescription instrumentedMethod, Assigner assigner, Assigner.Typing typing) Returns a stack manipulation that handles the method return.
-
Field Details
-
fieldDescription
The field to set.
-
-
Constructor Details
-
FieldSetting
Creates a new field-setting termination handler.- Parameters:
fieldDescription
- The field to set.
-
-
Method Details
-
prepare
Returns a preparing stack manipulation to apply prior to the method call.- Specified by:
prepare
in interfaceMethodCall.TerminationHandler
- Returns:
- The stack manipulation to apply prior to the method call.
-
toStackManipulation
public StackManipulation toStackManipulation(MethodDescription invokedMethod, MethodDescription instrumentedMethod, Assigner assigner, Assigner.Typing typing) Returns a stack manipulation that handles the method return.- Specified by:
toStackManipulation
in interfaceMethodCall.TerminationHandler
- Parameters:
invokedMethod
- The method that was invoked by the method call.instrumentedMethod
- The method being intercepted.assigner
- The assigner to be used.typing
- Indicates if dynamic type castings should be attempted for incompatible assignments.- Returns:
- A stack manipulation that handles the method return.
-