Package net.bytebuddy.implementation
Class InvokeDynamic.InvocationProvider.ArgumentProvider.ForInstance
- java.lang.Object
-
- net.bytebuddy.implementation.InvokeDynamic.InvocationProvider.ArgumentProvider.ForInstance
-
- All Implemented Interfaces:
InvokeDynamic.InvocationProvider.ArgumentProvider
- Enclosing interface:
- InvokeDynamic.InvocationProvider.ArgumentProvider
@Enhance public static class InvokeDynamic.InvocationProvider.ArgumentProvider.ForInstance extends java.lang.Object implements InvokeDynamic.InvocationProvider.ArgumentProvider
An argument provider for a value that is stored in a randomly named static field.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface net.bytebuddy.implementation.InvokeDynamic.InvocationProvider.ArgumentProvider
InvokeDynamic.InvocationProvider.ArgumentProvider.ConstantPoolWrapper, InvokeDynamic.InvocationProvider.ArgumentProvider.ForBooleanConstant, InvokeDynamic.InvocationProvider.ArgumentProvider.ForByteConstant, InvokeDynamic.InvocationProvider.ArgumentProvider.ForCharacterConstant, InvokeDynamic.InvocationProvider.ArgumentProvider.ForClassConstant, InvokeDynamic.InvocationProvider.ArgumentProvider.ForDoubleConstant, InvokeDynamic.InvocationProvider.ArgumentProvider.ForEnumerationValue, InvokeDynamic.InvocationProvider.ArgumentProvider.ForField, InvokeDynamic.InvocationProvider.ArgumentProvider.ForFloatConstant, InvokeDynamic.InvocationProvider.ArgumentProvider.ForInstance, InvokeDynamic.InvocationProvider.ArgumentProvider.ForIntegerConstant, InvokeDynamic.InvocationProvider.ArgumentProvider.ForInterceptedMethodInstanceAndParameters, InvokeDynamic.InvocationProvider.ArgumentProvider.ForInterceptedMethodParameters, InvokeDynamic.InvocationProvider.ArgumentProvider.ForJavaConstant, InvokeDynamic.InvocationProvider.ArgumentProvider.ForLongConstant, InvokeDynamic.InvocationProvider.ArgumentProvider.ForMethodParameter, InvokeDynamic.InvocationProvider.ArgumentProvider.ForNullValue, InvokeDynamic.InvocationProvider.ArgumentProvider.ForShortConstant, InvokeDynamic.InvocationProvider.ArgumentProvider.ForStringConstant, InvokeDynamic.InvocationProvider.ArgumentProvider.ForThisInstance, InvokeDynamic.InvocationProvider.ArgumentProvider.Resolved
-
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.String
FIELD_PREFIX
The prefix of any field generated by this argument provider.private TypeDescription
fieldType
The type of the static field.private java.lang.String
name
The name of the field.private java.lang.Object
value
The value that is stored in the static field.
-
Constructor Summary
Constructors Modifier Constructor Description protected
ForInstance(java.lang.Object value, TypeDescription fieldType)
Creates a new argument provider that stores the given value in a static field.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected static InvokeDynamic.InvocationProvider.ArgumentProvider
of(java.lang.Object value)
Creates a new argument provider that stores the given value in a static field of the instance type.InstrumentedType
prepare(InstrumentedType instrumentedType)
Prepares the instrumented type.InvokeDynamic.InvocationProvider.ArgumentProvider.Resolved
resolve(TypeDescription instrumentedType, MethodDescription instrumentedMethod, Assigner assigner, Assigner.Typing typing)
Resolves an argument provider.
-
-
-
Field Detail
-
FIELD_PREFIX
private static final java.lang.String FIELD_PREFIX
The prefix of any field generated by this argument provider.- See Also:
- Constant Field Values
-
value
private final java.lang.Object value
The value that is stored in the static field.
-
fieldType
private final TypeDescription fieldType
The type of the static field.
-
name
@ValueHandling(IGNORE) private final java.lang.String name
The name of the field.
-
-
Constructor Detail
-
ForInstance
protected ForInstance(java.lang.Object value, TypeDescription fieldType)
Creates a new argument provider that stores the given value in a static field.- Parameters:
value
- The value that is to be provided to the bootstrapped method.fieldType
- The type of the field which is also provided to the bootstrap method.
-
-
Method Detail
-
of
protected static InvokeDynamic.InvocationProvider.ArgumentProvider of(java.lang.Object value)
Creates a new argument provider that stores the given value in a static field of the instance type.- Parameters:
value
- The value that is to be provided to the bootstrapped method.- Returns:
- A corresponding argument provider.
-
resolve
public InvokeDynamic.InvocationProvider.ArgumentProvider.Resolved resolve(TypeDescription instrumentedType, MethodDescription instrumentedMethod, Assigner assigner, Assigner.Typing typing)
Resolves an argument provider.- Specified by:
resolve
in interfaceInvokeDynamic.InvocationProvider.ArgumentProvider
- Parameters:
instrumentedType
- The instrumented type.instrumentedMethod
- The instrumented method.assigner
- The assigner to be used.typing
- Indicates if dynamic type castings should be attempted for incompatible assignments.- Returns:
- A resolved version of this argument provider.
-
prepare
public InstrumentedType prepare(InstrumentedType instrumentedType)
Prepares the instrumented type.- Specified by:
prepare
in interfaceInvokeDynamic.InvocationProvider.ArgumentProvider
- Parameters:
instrumentedType
- The instrumented type.- Returns:
- The prepared instrumented type.
-
-