Enum Class MethodVariableAccess

java.lang.Object
java.lang.Enum<MethodVariableAccess>
net.bytebuddy.implementation.bytecode.member.MethodVariableAccess
All Implemented Interfaces:
Serializable, Comparable<MethodVariableAccess>, Constable

public enum MethodVariableAccess extends Enum<MethodVariableAccess>
A stack assignment that loads a method variable from a given index of the local variable array.
  • Enum Constant Details

  • Field Details

    • loadOpcode

      private final int loadOpcode
      The opcode for loading this variable type.
    • storeOpcode

      private final int storeOpcode
      The opcode for storing a local variable type.
    • size

      private final StackSize size
      The size of the local variable on the JVM stack.
  • Constructor Details

    • MethodVariableAccess

      private MethodVariableAccess(int loadOpcode, int storeOpcode, StackSize stackSize)
      Creates a new method variable access for a given JVM type.
      Parameters:
      loadOpcode - The opcode for loading this variable type.
      storeOpcode - The opcode for storing this variable type.
      stackSize - The size of the JVM type.
  • Method Details

    • values

      public static MethodVariableAccess[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static MethodVariableAccess valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • of

      public static MethodVariableAccess of(TypeDefinition typeDefinition)
      Locates the correct accessor for a variable of a given type.
      Parameters:
      typeDefinition - The type of the variable to be loaded.
      Returns:
      An accessor for the given type.
    • allArgumentsOf

      public static MethodVariableAccess.MethodLoading allArgumentsOf(MethodDescription methodDescription)
      Loads all arguments of the provided method onto the operand stack.
      Parameters:
      methodDescription - The method for which all parameters are to be loaded onto the operand stack.
      Returns:
      A stack manipulation that loads all parameters of the provided method onto the operand stack.
    • loadThis

      @Enhance("loadThis") public static StackManipulation loadThis()
      Loads a reference to the this reference what is only meaningful for a non-static method.
      Returns:
      A stack manipulation loading the this reference.
    • loadFrom

      public StackManipulation loadFrom(int offset)
      Creates a stack assignment for a reading given offset of the local variable array.
      Parameters:
      offset - The offset of the variable where double and long types count two slots.
      Returns:
      A stack manipulation representing the variable read.
    • storeAt

      public StackManipulation storeAt(int offset)
      Creates a stack assignment for writing to a given offset of the local variable array.
      Parameters:
      offset - The offset of the variable where double and long types count two slots.
      Returns:
      A stack manipulation representing the variable write.
    • increment

      public StackManipulation increment(int offset, int value)
      Creates a stack assignment for incrementing the given offset of the local variable array.
      Parameters:
      offset - The offset of the variable where double and long types count two slots.
      value - The incremented value.
      Returns:
      A stack manipulation representing the variable write.
    • load

      public static StackManipulation load(ParameterDescription parameterDescription)
      Loads a parameter's value onto the operand stack.
      Parameters:
      parameterDescription - The parameter which to load onto the operand stack.
      Returns:
      A stack manipulation loading a parameter onto the operand stack.
    • store

      public static StackManipulation store(ParameterDescription parameterDescription)
      Stores the top operand stack value at the supplied parameter.
      Parameters:
      parameterDescription - The parameter which to store a value for.
      Returns:
      A stack manipulation storing the top operand stack value at this parameter.
    • increment

      public static StackManipulation increment(ParameterDescription parameterDescription, int value)
      Increments the value of the supplied parameter.
      Parameters:
      parameterDescription - The parameter which to increment.
      value - The value to increment with.
      Returns:
      A stack manipulation incrementing the supplied parameter.