Package net.bytebuddy.implementation
Class MethodCall.ArgumentLoader.ForStackManipulation
java.lang.Object
net.bytebuddy.implementation.MethodCall.ArgumentLoader.ForStackManipulation
- All Implemented Interfaces:
InstrumentedType.Prepareable
,MethodCall.ArgumentLoader
,MethodCall.ArgumentLoader.ArgumentProvider
,MethodCall.ArgumentLoader.Factory
- Enclosing interface:
- MethodCall.ArgumentLoader
@Enhance
public static class MethodCall.ArgumentLoader.ForStackManipulation
extends Object
implements MethodCall.ArgumentLoader, MethodCall.ArgumentLoader.ArgumentProvider, MethodCall.ArgumentLoader.Factory
Loads a stack manipulation resulting in a specific type as an argument.
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.bytebuddy.dynamic.scaffold.InstrumentedType.Prepareable
InstrumentedType.Prepareable.NoOp
Nested classes/interfaces inherited from interface net.bytebuddy.implementation.MethodCall.ArgumentLoader
MethodCall.ArgumentLoader.ArgumentProvider, MethodCall.ArgumentLoader.Factory, MethodCall.ArgumentLoader.ForField, MethodCall.ArgumentLoader.ForInstance, MethodCall.ArgumentLoader.ForInstrumentedType, MethodCall.ArgumentLoader.ForMethodCall, MethodCall.ArgumentLoader.ForMethodParameter, MethodCall.ArgumentLoader.ForMethodParameterArray, MethodCall.ArgumentLoader.ForMethodParameterArrayElement, MethodCall.ArgumentLoader.ForNullConstant, MethodCall.ArgumentLoader.ForStackManipulation, MethodCall.ArgumentLoader.ForThisReference
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final StackManipulation
The stack manipulation to load.private final TypeDefinition
The type of the resulting value. -
Constructor Summary
ConstructorsConstructorDescriptionForStackManipulation
(StackManipulation stackManipulation, Type type) Creates an argument loader that loads a stack manipulation as an argument.ForStackManipulation
(StackManipulation stackManipulation, TypeDefinition typeDefinition) Creates an argument loader that loads a stack manipulation as an argument. -
Method Summary
Modifier and TypeMethodDescriptionmake
(Implementation.Target implementationTarget) Creates an argument provider for the supplied implementation target.Creates an argument loader that loads the supplied value as a constant.prepare
(InstrumentedType instrumentedType) Prepares a given instrumented type.resolve
(MethodDescription instrumentedMethod, MethodDescription invokedMethod) Resolves this provider to an argument loader for each provided argument.toStackManipulation
(ParameterDescription target, Assigner assigner, Assigner.Typing typing) Loads the argument that is represented by this instance onto the operand stack.
-
Field Details
-
stackManipulation
The stack manipulation to load. -
typeDefinition
The type of the resulting value.
-
-
Constructor Details
-
ForStackManipulation
Creates an argument loader that loads a stack manipulation as an argument.- Parameters:
stackManipulation
- The stack manipulation to load.type
- The type of the resulting value.
-
ForStackManipulation
Creates an argument loader that loads a stack manipulation as an argument.- Parameters:
stackManipulation
- The stack manipulation to load.typeDefinition
- The type of the resulting value.
-
-
Method Details
-
of
Creates an argument loader that loads the supplied value as a constant. If the value cannot be represented in the constant pool, a field is created to store the value.- Parameters:
value
- The value to load as an argument ornull
.- Returns:
- An appropriate argument loader.
-
prepare
Prepares a given instrumented type.- Specified by:
prepare
in interfaceInstrumentedType.Prepareable
- Parameters:
instrumentedType
- The instrumented type in its current form.- Returns:
- The prepared instrumented type.
-
make
Creates an argument provider for the supplied implementation target.- Specified by:
make
in interfaceMethodCall.ArgumentLoader.Factory
- Parameters:
implementationTarget
- The implementation target to use.- Returns:
- An appropriate argument provider.
-
resolve
public List<MethodCall.ArgumentLoader> resolve(MethodDescription instrumentedMethod, MethodDescription invokedMethod) Resolves this provider to an argument loader for each provided argument.- Specified by:
resolve
in interfaceMethodCall.ArgumentLoader.ArgumentProvider
- Parameters:
instrumentedMethod
- The instrumented method.invokedMethod
- The invoked method.- Returns:
- A list of provided argument loaders.
-
toStackManipulation
public StackManipulation toStackManipulation(ParameterDescription target, Assigner assigner, Assigner.Typing typing) Loads the argument that is represented by this instance onto the operand stack.- Specified by:
toStackManipulation
in interfaceMethodCall.ArgumentLoader
- Parameters:
target
- The target parameter.assigner
- The assigner to be used.typing
- Indicates if dynamic type castings should be attempted for incompatible assignments.- Returns:
- The stack manipulation that loads the represented argument onto the stack.
-