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 java.lang.Object implements MethodCall.TerminationHandler
A termination handler that sets a field.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classMethodCall.TerminationHandler.FieldSetting.ExplicitA factory for a field-setting termination handler that locates a given field.protected static classMethodCall.TerminationHandler.FieldSetting.ImplicitA 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 Modifier and Type Field Description private FieldDescriptionfieldDescriptionThe field to set.
-
Constructor Summary
Constructors Modifier Constructor Description protectedFieldSetting(FieldDescription fieldDescription)Creates a new field-setting termination handler.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StackManipulationprepare()Returns a preparing stack manipulation to apply prior to the method call.StackManipulationtoStackManipulation(MethodDescription invokedMethod, MethodDescription instrumentedMethod, Assigner assigner, Assigner.Typing typing)Returns a stack manipulation that handles the method return.
-
-
-
Field Detail
-
fieldDescription
private final FieldDescription fieldDescription
The field to set.
-
-
Constructor Detail
-
FieldSetting
protected FieldSetting(FieldDescription fieldDescription)
Creates a new field-setting termination handler.- Parameters:
fieldDescription- The field to set.
-
-
Method Detail
-
prepare
public StackManipulation prepare()
Returns a preparing stack manipulation to apply prior to the method call.- Specified by:
preparein 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:
toStackManipulationin 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.
-
-