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.
  • Field Details

    • fieldDescription

      private final FieldDescription fieldDescription
      The field to set.
  • Constructor Details

    • FieldSetting

      protected FieldSetting(FieldDescription fieldDescription)
      Creates a new field-setting termination handler.
      Parameters:
      fieldDescription - The field to set.
  • Method Details

    • prepare

      public StackManipulation prepare()
      Returns a preparing stack manipulation to apply prior to the method call.
      Specified by:
      prepare in interface MethodCall.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 interface MethodCall.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.