public static class JavaConstant.Dynamic extends Object implements JavaConstant
JavaConstant.Dynamic, JavaConstant.MethodHandle, JavaConstant.MethodType| Modifier | Constructor and Description |
|---|---|
protected |
Dynamic(ConstantDynamic value,
TypeDescription typeDescription)
Creates a new dynamic class pool entry.
|
| Modifier and Type | Method and Description |
|---|---|
Object |
asConstantPoolValue()
Returns the represented instance as a constant pool value.
|
static JavaConstant.Dynamic |
bootstrap(String name,
Constructor<?> constructor,
List<?> rawArguments)
Binds the supplied bootstrap constructor for the resolution of a dynamic constant.
|
static JavaConstant.Dynamic |
bootstrap(String name,
Constructor<?> constructor,
Object... rawArgument)
Binds the supplied bootstrap constructor for the resolution of a dynamic constant.
|
static JavaConstant.Dynamic |
bootstrap(String name,
MethodDescription.InDefinedShape bootstrapMethod,
List<?> rawArguments)
Binds the supplied bootstrap method or constructor for the resolution of a dynamic constant.
|
static JavaConstant.Dynamic |
bootstrap(String name,
MethodDescription.InDefinedShape bootstrapMethod,
Object... rawArgument)
Binds the supplied bootstrap method or constructor for the resolution of a dynamic constant.
|
static JavaConstant.Dynamic |
bootstrap(String name,
Method method,
List<?> rawArguments)
Binds the supplied bootstrap method for the resolution of a dynamic constant.
|
static JavaConstant.Dynamic |
bootstrap(String name,
Method method,
Object... rawArgument)
Binds the supplied bootstrap method for the resolution of a dynamic constant.
|
boolean |
equals(Object other) |
TypeDescription |
getType()
Returns a description of the type of the represented instance or at least a stub.
|
int |
hashCode() |
static JavaConstant |
ofArrayVarHandle(Class<?> type)
Resolves a var handle constant for an array.
|
static JavaConstant |
ofArrayVarHandle(TypeDescription typeDescription)
Resolves a var handle constant for an array.
|
static JavaConstant |
ofEnumeration(Enum<?> enumeration)
Returns a
Enum value constant. |
static JavaConstant |
ofEnumeration(EnumerationDescription enumerationDescription)
Returns a
Enum value constant. |
static JavaConstant.Dynamic |
ofField(Field field)
Returns a
static, final field constant. |
static JavaConstant.Dynamic |
ofField(FieldDescription.InDefinedShape fieldDescription)
Returns a
static, final field constant. |
static JavaConstant.Dynamic |
ofInvocation(Constructor<?> constructor,
List<?> rawArguments)
Represents a constant that is resolved by invoking a constructor.
|
static JavaConstant.Dynamic |
ofInvocation(Constructor<?> constructor,
Object... rawArgument)
Represents a constant that is resolved by invoking a constructor.
|
static JavaConstant.Dynamic |
ofInvocation(MethodDescription.InDefinedShape methodDescription,
List<?> rawArguments)
Represents a constant that is resolved by invoking a
static factory method or a constructor. |
static JavaConstant.Dynamic |
ofInvocation(MethodDescription.InDefinedShape methodDescription,
Object... rawArgument)
Represents a constant that is resolved by invoking a
static factory method or a constructor. |
static JavaConstant.Dynamic |
ofInvocation(Method method,
List<?> rawArguments)
Represents a constant that is resolved by invoking a
static factory method. |
static JavaConstant.Dynamic |
ofInvocation(Method method,
Object... rawArgument)
Represents a constant that is resolved by invoking a
static factory method. |
static JavaConstant.Dynamic |
ofNullConstant()
Returns a constant
null value of type Object. |
static JavaConstant |
ofPrimitiveType(Class<?> type)
Returns a
Class constant for a primitive type. |
static JavaConstant |
ofPrimitiveType(TypeDescription typeDescription)
Returns a
Class constant for a primitive type. |
static JavaConstant |
ofVarHandle(Field field)
Resolves a var handle constant for a field.
|
static JavaConstant |
ofVarHandle(FieldDescription.InDefinedShape fieldDescription)
Resolves a var handle constant for a field.
|
JavaConstant |
withType(Class<?> type)
Resolves this
JavaConstant.Dynamic constant to resolve the returned instance to the supplied type. |
JavaConstant |
withType(TypeDescription typeDescription)
Resolves this
JavaConstant.Dynamic constant to resolve the returned instance to the supplied type. |
protected Dynamic(ConstantDynamic value, TypeDescription typeDescription)
value - The represented bootstrap value.typeDescription - The represented value constant.public static JavaConstant.Dynamic ofNullConstant()
null value of type Object.public static JavaConstant ofPrimitiveType(Class<?> type)
Class constant for a primitive type.type - The primitive type to represent.public static JavaConstant ofPrimitiveType(TypeDescription typeDescription)
Class constant for a primitive type.typeDescription - The primitive type to represent.public static JavaConstant ofEnumeration(Enum<?> enumeration)
Enum value constant.enumeration - The enumeration value to represent.public static JavaConstant ofEnumeration(EnumerationDescription enumerationDescription)
Enum value constant.enumerationDescription - The enumeration value to represent.public static JavaConstant.Dynamic ofField(Field field)
static, final field constant.field - The field to represent a value of.public static JavaConstant.Dynamic ofField(FieldDescription.InDefinedShape fieldDescription)
static, final field constant.fieldDescription - The field to represent a value of.public static JavaConstant.Dynamic ofInvocation(Method method, Object... rawArgument)
static factory method.method - The method to invoke to create the represented constant value.rawArgument - The method's constant arguments.public static JavaConstant.Dynamic ofInvocation(Method method, List<?> rawArguments)
static factory method.method - The method to invoke to create the represented constant value.rawArguments - The method's constant arguments.public static JavaConstant.Dynamic ofInvocation(Constructor<?> constructor, Object... rawArgument)
constructor - The constructor to invoke to create the represented constant value.rawArgument - The constructor's constant arguments.public static JavaConstant.Dynamic ofInvocation(Constructor<?> constructor, List<?> rawArguments)
constructor - The constructor to invoke to create the represented constant value.rawArguments - The constructor's constant arguments.public static JavaConstant.Dynamic ofInvocation(MethodDescription.InDefinedShape methodDescription, Object... rawArgument)
static factory method or a constructor.methodDescription - The method or constructor to invoke to create the represented constant value.rawArgument - The method's or constructor's constant arguments.public static JavaConstant.Dynamic ofInvocation(MethodDescription.InDefinedShape methodDescription, List<?> rawArguments)
static factory method or a constructor.methodDescription - The method or constructor to invoke to create the represented constant value.rawArguments - The method's or constructor's constant arguments.public static JavaConstant ofVarHandle(Field field)
field - The field to represent a var handle for.public static JavaConstant ofVarHandle(FieldDescription.InDefinedShape fieldDescription)
fieldDescription - The field to represent a var handle for.public static JavaConstant ofArrayVarHandle(Class<?> type)
type - The array type for which the var handle is resolved.public static JavaConstant ofArrayVarHandle(TypeDescription typeDescription)
typeDescription - The array type for which the var handle is resolved.public static JavaConstant.Dynamic bootstrap(String name, Method method, Object... rawArgument)
name - The name of the bootstrap constant that is provided to the bootstrap method or constructor.method - The bootstrap method to invoke.rawArgument - The arguments for the bootstrap method represented as primitive wrapper types,
String, TypeDescription or JavaConstant values or their loaded forms.public static JavaConstant.Dynamic bootstrap(String name, Method method, List<?> rawArguments)
name - The name of the bootstrap constant that is provided to the bootstrap method or constructor.method - The bootstrap method to invoke.rawArguments - The arguments for the bootstrap method represented as primitive wrapper types,
String, TypeDescription or JavaConstant values or their loaded forms.public static JavaConstant.Dynamic bootstrap(String name, Constructor<?> constructor, Object... rawArgument)
name - The name of the bootstrap constant that is provided to the bootstrap method or constructor.constructor - The bootstrap constructor to invoke.rawArgument - The arguments for the bootstrap constructor represented as primitive wrapper types,
String, TypeDescription or JavaConstant values or their loaded forms.public static JavaConstant.Dynamic bootstrap(String name, Constructor<?> constructor, List<?> rawArguments)
name - The name of the bootstrap constant that is provided to the bootstrap method or constructor.constructor - The bootstrap constructor to invoke.rawArguments - The arguments for the bootstrap constructor represented as primitive wrapper types,
String, TypeDescription or JavaConstant values or their loaded forms.public static JavaConstant.Dynamic bootstrap(String name, MethodDescription.InDefinedShape bootstrapMethod, Object... rawArgument)
name - The name of the bootstrap constant that is provided to the bootstrap method or constructor.bootstrapMethod - The bootstrap method or constructor to invoke.rawArgument - The arguments for the bootstrap method or constructor represented as primitive wrapper types,
String, TypeDescription or JavaConstant values or their loaded forms.public static JavaConstant.Dynamic bootstrap(String name, MethodDescription.InDefinedShape bootstrapMethod, List<?> rawArguments)
name - The name of the bootstrap constant that is provided to the bootstrap method or constructor.bootstrapMethod - The bootstrap method or constructor to invoke.rawArguments - The arguments for the bootstrap method or constructor represented as primitive wrapper types,
String, TypeDescription or JavaConstant values or their loaded forms.public JavaConstant withType(Class<?> type)
JavaConstant.Dynamic constant to resolve the returned instance to the supplied type. The type must be a subtype of the
bootstrap method's return type. Constructors cannot be resolved to a different type.type - The type to resolve the bootstrapped value to.public JavaConstant withType(TypeDescription typeDescription)
JavaConstant.Dynamic constant to resolve the returned instance to the supplied type. The type must be a subtype of the
bootstrap method's return type. Constructors cannot be resolved to a different type.typeDescription - The type to resolve the bootstrapped value to.public Object asConstantPoolValue()
asConstantPoolValue in interface JavaConstantpublic TypeDescription getType()
getType in interface JavaConstantCopyright © 2014–2019. All rights reserved.