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.Factory
- Enclosing interface:
- MethodCall.ArgumentLoader
@Enhance public static class MethodCall.ArgumentLoader.ForStackManipulation extends java.lang.Object implements MethodCall.ArgumentLoader, 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.implementation.MethodCall.ArgumentLoader
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
Fields Modifier and Type Field Description private StackManipulation
stackManipulation
The stack manipulation to load.private TypeDefinition
typeDefinition
The type of the resulting value.
-
Constructor Summary
Constructors Constructor Description ForStackManipulation(StackManipulation stackManipulation, java.lang.reflect.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
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.List<MethodCall.ArgumentLoader>
make(Implementation.Target implementationTarget, TypeDescription instrumentedType, MethodDescription instrumentedMethod, MethodDescription invokedMethod)
Creates any number of argument loaders for an instrumentation.static MethodCall.ArgumentLoader.Factory
of(java.lang.Object value)
Creates an argument loader that loads the supplied value as a constant.InstrumentedType
prepare(InstrumentedType instrumentedType)
Prepares a given instrumented type.StackManipulation
resolve(ParameterDescription target, Assigner assigner, Assigner.Typing typing)
Loads the argument that is represented by this instance onto the operand stack.
-
-
-
Field Detail
-
stackManipulation
private final StackManipulation stackManipulation
The stack manipulation to load.
-
typeDefinition
private final TypeDefinition typeDefinition
The type of the resulting value.
-
-
Constructor Detail
-
ForStackManipulation
public ForStackManipulation(StackManipulation stackManipulation, java.lang.reflect.Type type)
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
public ForStackManipulation(StackManipulation stackManipulation, TypeDefinition typeDefinition)
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 Detail
-
of
public static MethodCall.ArgumentLoader.Factory of(java.lang.Object value)
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
public InstrumentedType prepare(InstrumentedType instrumentedType)
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
public java.util.List<MethodCall.ArgumentLoader> make(Implementation.Target implementationTarget, TypeDescription instrumentedType, MethodDescription instrumentedMethod, MethodDescription invokedMethod)
Creates any number of argument loaders for an instrumentation.- Specified by:
make
in interfaceMethodCall.ArgumentLoader.Factory
- Parameters:
implementationTarget
- The implementation target.instrumentedType
- The instrumented type.instrumentedMethod
- The instrumented method.invokedMethod
- The invoked method.- Returns:
- Any number of argument loaders to supply for the method call.
-
resolve
public StackManipulation resolve(ParameterDescription target, Assigner assigner, Assigner.Typing typing)
Loads the argument that is represented by this instance onto the operand stack.- Specified by:
resolve
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.
-
-