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 class
MethodCall.TerminationHandler.FieldSetting.Explicit
A factory for a field-setting termination handler that locates a given field.protected static class
MethodCall.TerminationHandler.FieldSetting.Implicit
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 Modifier and Type Field Description private FieldDescription
fieldDescription
The field to set.
-
Constructor Summary
Constructors Modifier Constructor Description protected
FieldSetting(FieldDescription fieldDescription)
Creates a new field-setting termination handler.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StackManipulation
prepare()
Returns a preparing stack manipulation to apply prior to the method call.StackManipulation
toStackManipulation(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:
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.
-
-