public static class JavaConstant.Dynamic extends java.lang.Object implements JavaConstant
JavaConstant.Dynamic, JavaConstant.MethodHandle, JavaConstant.MethodType
Modifier and Type | Field and Description |
---|---|
private static java.lang.String |
CONSTANT_BOOTSTRAPS
The
java.lang.invoke.ConstantBootstraps class's internal name.. |
private TypeDescription |
typeDescription
The represented value constant.
|
private org.objectweb.asm.ConstantDynamic |
value
The represented bootstrap value.
|
Modifier | Constructor and Description |
---|---|
protected |
Dynamic(org.objectweb.asm.ConstantDynamic value,
TypeDescription typeDescription)
Creates a new dynamic class pool entry.
|
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
asConstantPoolValue()
Returns the represented instance as a constant pool value.
|
static JavaConstant.Dynamic |
bootstrap(java.lang.String name,
java.lang.reflect.Constructor<?> constructor,
java.util.List<?> rawArguments)
Binds the supplied bootstrap constructor for the resolution of a dynamic constant.
|
static JavaConstant.Dynamic |
bootstrap(java.lang.String name,
java.lang.reflect.Constructor<?> constructor,
java.lang.Object... rawArgument)
Binds the supplied bootstrap constructor for the resolution of a dynamic constant.
|
static JavaConstant.Dynamic |
bootstrap(java.lang.String name,
MethodDescription.InDefinedShape bootstrapMethod,
java.util.List<?> rawArguments)
Binds the supplied bootstrap method or constructor for the resolution of a dynamic constant.
|
static JavaConstant.Dynamic |
bootstrap(java.lang.String name,
MethodDescription.InDefinedShape bootstrapMethod,
java.lang.Object... rawArgument)
Binds the supplied bootstrap method or constructor for the resolution of a dynamic constant.
|
static JavaConstant.Dynamic |
bootstrap(java.lang.String name,
java.lang.reflect.Method method,
java.util.List<?> rawArguments)
Binds the supplied bootstrap method for the resolution of a dynamic constant.
|
static JavaConstant.Dynamic |
bootstrap(java.lang.String name,
java.lang.reflect.Method method,
java.lang.Object... rawArgument)
Binds the supplied bootstrap method for the resolution of a dynamic constant.
|
boolean |
equals(java.lang.Object other) |
TypeDescription |
getType()
Returns a description of the type of the represented instance or at least a stub.
|
int |
hashCode() |
static JavaConstant |
ofArrayVarHandle(java.lang.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(java.lang.Enum<?> enumeration)
Returns a
Enum value constant. |
static JavaConstant |
ofEnumeration(EnumerationDescription enumerationDescription)
Returns a
Enum value constant. |
static JavaConstant.Dynamic |
ofField(java.lang.reflect.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(java.lang.reflect.Constructor<?> constructor,
java.util.List<?> rawArguments)
Represents a constant that is resolved by invoking a constructor.
|
static JavaConstant.Dynamic |
ofInvocation(java.lang.reflect.Constructor<?> constructor,
java.lang.Object... rawArgument)
Represents a constant that is resolved by invoking a constructor.
|
static JavaConstant.Dynamic |
ofInvocation(MethodDescription.InDefinedShape methodDescription,
java.util.List<?> rawArguments)
Represents a constant that is resolved by invoking a
static factory method or a constructor. |
static JavaConstant.Dynamic |
ofInvocation(MethodDescription.InDefinedShape methodDescription,
java.lang.Object... rawArgument)
Represents a constant that is resolved by invoking a
static factory method or a constructor. |
static JavaConstant.Dynamic |
ofInvocation(java.lang.reflect.Method method,
java.util.List<?> rawArguments)
Represents a constant that is resolved by invoking a
static factory method. |
static JavaConstant.Dynamic |
ofInvocation(java.lang.reflect.Method method,
java.lang.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(java.lang.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(java.lang.reflect.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(java.lang.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. |
private static final java.lang.String CONSTANT_BOOTSTRAPS
java.lang.invoke.ConstantBootstraps
class's internal name..private final org.objectweb.asm.ConstantDynamic value
private final TypeDescription typeDescription
protected Dynamic(org.objectweb.asm.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(java.lang.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(java.lang.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(java.lang.reflect.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(java.lang.reflect.Method method, java.lang.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(java.lang.reflect.Method method, java.util.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(java.lang.reflect.Constructor<?> constructor, java.lang.Object... rawArgument)
constructor
- The constructor to invoke to create the represented constant value.rawArgument
- The constructor's constant arguments.public static JavaConstant.Dynamic ofInvocation(java.lang.reflect.Constructor<?> constructor, java.util.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, java.lang.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, java.util.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(java.lang.reflect.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(java.lang.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(java.lang.String name, java.lang.reflect.Method method, java.lang.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(java.lang.String name, java.lang.reflect.Method method, java.util.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(java.lang.String name, java.lang.reflect.Constructor<?> constructor, java.lang.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(java.lang.String name, java.lang.reflect.Constructor<?> constructor, java.util.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(java.lang.String name, MethodDescription.InDefinedShape bootstrapMethod, java.lang.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(java.lang.String name, MethodDescription.InDefinedShape bootstrapMethod, java.util.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(java.lang.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 java.lang.Object asConstantPoolValue()
asConstantPoolValue
in interface JavaConstant
public TypeDescription getType()
getType
in interface JavaConstant
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object other)
equals
in class java.lang.Object