Class MethodVariableAccess.MethodLoading

java.lang.Object
net.bytebuddy.implementation.bytecode.StackManipulation.AbstractBase
net.bytebuddy.implementation.bytecode.member.MethodVariableAccess.MethodLoading
All Implemented Interfaces:
StackManipulation
Enclosing class:
MethodVariableAccess

@Enhance public static class MethodVariableAccess.MethodLoading extends StackManipulation.AbstractBase
A stack manipulation that loads all parameters of a given method onto the operand stack.
  • Field Details

  • Constructor Details

    • MethodLoading

      protected MethodLoading(MethodDescription methodDescription, MethodVariableAccess.MethodLoading.TypeCastingHandler typeCastingHandler)
      Creates a new method loading stack manipulation.
      Parameters:
      methodDescription - The method for which all parameters are loaded onto the operand stack.
      typeCastingHandler - A type casting handler which is capable of transforming all method parameters.
  • Method Details

    • 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.
    • prependThisReference

      public StackManipulation prependThisReference()
      Prepends a reference to the this instance to the loaded parameters if the represented method is non-static.
      Returns:
      A stack manipulation that loads all method parameters onto the operand stack while additionally loading a reference to this if the represented is non-static. Any potential parameter transformation is preserved.
    • asBridgeOf

      public MethodVariableAccess.MethodLoading asBridgeOf(MethodDescription bridgeTarget)
      Applies a transformation to all loaded arguments of the method being loaded to be casted to the corresponding parameter of the provided method. This way, the parameters can be used for invoking a bridge target method.
      Parameters:
      bridgeTarget - The method that is the target of the bridge method for which the parameters are being loaded.
      Returns:
      A stack manipulation that loads all parameters casted to the types of the supplied bridge target.