Package org.datanucleus.enhancer.asm
Class ConstantDynamic
- java.lang.Object
-
- org.datanucleus.enhancer.asm.ConstantDynamic
-
public final class ConstantDynamic extends java.lang.Object
A constant whose value is computed at runtime, with a bootstrap method.
-
-
Field Summary
Fields Modifier and Type Field Description private Handle
bootstrapMethod
The bootstrap method to use to compute the constant value at runtime.private java.lang.Object[]
bootstrapMethodArguments
The arguments to pass to the bootstrap method, in order to compute the constant value at runtime.private java.lang.String
descriptor
The constant type (must be a field descriptor).private java.lang.String
name
The constant name (can be arbitrary).
-
Constructor Summary
Constructors Constructor Description ConstantDynamic(java.lang.String name, java.lang.String descriptor, Handle bootstrapMethod, java.lang.Object... bootstrapMethodArguments)
Constructs a newConstantDynamic
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object object)
Handle
getBootstrapMethod()
Returns the bootstrap method used to compute the value of this constant.java.lang.Object
getBootstrapMethodArgument(int index)
Returns an argument passed to the bootstrap method, in order to compute the value of this constant.int
getBootstrapMethodArgumentCount()
Returns the number of arguments passed to the bootstrap method, in order to compute the value of this constant.(package private) java.lang.Object[]
getBootstrapMethodArgumentsUnsafe()
Returns the arguments to pass to the bootstrap method, in order to compute the value of this constant.java.lang.String
getDescriptor()
Returns the type of this constant.java.lang.String
getName()
Returns the name of this constant.int
getSize()
Returns the size of this constant.int
hashCode()
java.lang.String
toString()
-
-
-
Field Detail
-
name
private final java.lang.String name
The constant name (can be arbitrary).
-
descriptor
private final java.lang.String descriptor
The constant type (must be a field descriptor).
-
bootstrapMethod
private final Handle bootstrapMethod
The bootstrap method to use to compute the constant value at runtime.
-
bootstrapMethodArguments
private final java.lang.Object[] bootstrapMethodArguments
The arguments to pass to the bootstrap method, in order to compute the constant value at runtime.
-
-
Constructor Detail
-
ConstantDynamic
public ConstantDynamic(java.lang.String name, java.lang.String descriptor, Handle bootstrapMethod, java.lang.Object... bootstrapMethodArguments)
Constructs a newConstantDynamic
.- Parameters:
name
- the constant name (can be arbitrary).descriptor
- the constant type (must be a field descriptor).bootstrapMethod
- the bootstrap method to use to compute the constant value at runtime.bootstrapMethodArguments
- the arguments to pass to the bootstrap method, in order to compute the constant value at runtime.
-
-
Method Detail
-
getName
public java.lang.String getName()
Returns the name of this constant.- Returns:
- the name of this constant.
-
getDescriptor
public java.lang.String getDescriptor()
Returns the type of this constant.- Returns:
- the type of this constant, as a field descriptor.
-
getBootstrapMethod
public Handle getBootstrapMethod()
Returns the bootstrap method used to compute the value of this constant.- Returns:
- the bootstrap method used to compute the value of this constant.
-
getBootstrapMethodArgumentCount
public int getBootstrapMethodArgumentCount()
Returns the number of arguments passed to the bootstrap method, in order to compute the value of this constant.- Returns:
- the number of arguments passed to the bootstrap method, in order to compute the value of this constant.
-
getBootstrapMethodArgument
public java.lang.Object getBootstrapMethodArgument(int index)
Returns an argument passed to the bootstrap method, in order to compute the value of this constant.- Parameters:
index
- an argument index, between 0 andgetBootstrapMethodArgumentCount()
(exclusive).- Returns:
- the argument passed to the bootstrap method, with the given index.
-
getBootstrapMethodArgumentsUnsafe
java.lang.Object[] getBootstrapMethodArgumentsUnsafe()
Returns the arguments to pass to the bootstrap method, in order to compute the value of this constant. WARNING: this array must not be modified, and must not be returned to the user.- Returns:
- the arguments to pass to the bootstrap method, in order to compute the value of this constant.
-
getSize
public int getSize()
Returns the size of this constant.- Returns:
- the size of this constant, i.e., 2 for
long
anddouble
, 1 otherwise.
-
equals
public boolean equals(java.lang.Object object)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-