Class MethodVariableAccess.MethodLoading
- java.lang.Object
-
- net.bytebuddy.implementation.bytecode.member.MethodVariableAccess.MethodLoading
-
- All Implemented Interfaces:
StackManipulation
- Enclosing class:
- MethodVariableAccess
@Enhance public static class MethodVariableAccess.MethodLoading extends java.lang.Object implements StackManipulation
A stack manipulation that loads all parameters of a given method onto the operand stack.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static interfaceMethodVariableAccess.MethodLoading.TypeCastingHandlerA 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.Compound, StackManipulation.Illegal, StackManipulation.Size, StackManipulation.Trivial
-
-
Field Summary
Fields Modifier and Type Field Description private MethodDescriptionmethodDescriptionThe method for which all parameters are loaded onto the operand stack.private MethodVariableAccess.MethodLoading.TypeCastingHandlertypeCastingHandlerA type casting handler which is capable of transforming all method parameters.
-
Constructor Summary
Constructors Modifier Constructor Description protectedMethodLoading(MethodDescription methodDescription, MethodVariableAccess.MethodLoading.TypeCastingHandler typeCastingHandler)Creates a new method loading stack manipulation.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StackManipulation.Sizeapply(org.objectweb.asm.MethodVisitor methodVisitor, Implementation.Context implementationContext)Applies the stack manipulation that is described by this instance.MethodVariableAccess.MethodLoadingasBridgeOf(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.booleanisValid()Determines if this stack manipulation is valid.StackManipulationprependThisReference()Prepends a reference to thethisinstance to the loaded parameters if the represented method is non-static.
-
-
-
Field Detail
-
methodDescription
private final MethodDescription methodDescription
The method for which all parameters are loaded onto the operand stack.
-
typeCastingHandler
private final MethodVariableAccess.MethodLoading.TypeCastingHandler typeCastingHandler
A type casting handler which is capable of transforming all method parameters.
-
-
Constructor Detail
-
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 Detail
-
isValid
public boolean isValid()
Determines if this stack manipulation is valid.- Specified by:
isValidin interfaceStackManipulation- Returns:
- If
false, this manipulation cannot be applied and should throw an exception.
-
apply
public StackManipulation.Size apply(org.objectweb.asm.MethodVisitor methodVisitor, Implementation.Context implementationContext)
Applies the stack manipulation that is described by this instance.- Specified by:
applyin interfaceStackManipulation- 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 thethisinstance 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
thisif 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.
-
-