Class SerializedConstant

java.lang.Object
net.bytebuddy.implementation.bytecode.StackManipulation.AbstractBase
net.bytebuddy.implementation.bytecode.constant.SerializedConstant
All Implemented Interfaces:
StackManipulation

@Enhance public class SerializedConstant extends StackManipulation.AbstractBase
A constant that represents a value in its serialized form.
  • Field Details

    • CHARSET

      private static final String CHARSET
      A charset that does not change the supplied byte array upon encoding or decoding.
      See Also:
    • serialization

      private final String serialization
      The serialized value.
  • Constructor Details

    • SerializedConstant

      protected SerializedConstant(String serialization)
      Creates a new constant for a serialized value.
      Parameters:
      serialization - The serialized value.
  • Method Details

    • of

      public static StackManipulation of(@MaybeNull Serializable value)
      Creates a new stack manipulation to load the supplied value onto the stack.
      Parameters:
      value - The value to serialize or null.
      Returns:
      A stack manipulation to serialize the supplied value.
    • apply

      public StackManipulation.Size apply(org.objectweb.asm.MethodVisitor methodVisitor, Implementation.Context implementationContext)
      Applies the stack manipulation that is described by this instance.
      Parameters:
      methodVisitor - The method visitor used to write the method implementation to.
      implementationContext - The context of the current implementation.
      Returns:
      The changes to the size of the operand stack that are implied by this stack manipulation.