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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static interface
A type casting handler allows a type transformation of all arguments of a method after loading them onto the operand stack.Nested classes/interfaces inherited from interface net.bytebuddy.implementation.bytecode.StackManipulation
StackManipulation.AbstractBase, StackManipulation.Compound, StackManipulation.Illegal, StackManipulation.Simple, StackManipulation.Size, StackManipulation.Trivial
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final MethodDescription
The method for which all parameters are loaded onto the operand stack.private final MethodVariableAccess.MethodLoading.TypeCastingHandler
A type casting handler which is capable of transforming all method parameters. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
MethodLoading
(MethodDescription methodDescription, MethodVariableAccess.MethodLoading.TypeCastingHandler typeCastingHandler) Creates a new method loading stack manipulation. -
Method Summary
Modifier and TypeMethodDescriptionapply
(org.objectweb.asm.MethodVisitor methodVisitor, Implementation.Context implementationContext) Applies the stack manipulation that is described by this instance.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.Prepends a reference to thethis
instance to the loaded parameters if the represented method is non-static.Methods inherited from class net.bytebuddy.implementation.bytecode.StackManipulation.AbstractBase
isValid
-
Field Details
-
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.
-
-
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
Prepends a reference to thethis
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
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.
-