Interface Const
- All Superinterfaces:
Constable, Expr, SimpleTyped, Typed
An expression which wraps a
ConstantDesc.-
Method Summary
Modifier and TypeMethodDescriptiondesc()Returns the description of the constant.static Constof(boolean value) Returns a constant for the given value.static Constof(byte value) Returns a constant for the given value.static Constof(char value) Returns a constant for the given value.static Constof(double value) Returns a constant for the given value.static ConstReturns a constant for the given value.static Constof(float value) Returns a constant for the given value.static ConstReturns a constant for the given value.static Constof(int value) Returns a constant for the given value.static ConstReturns a constant for the given value.static Constof(long value) Returns a constant for the given value.static ConstReturns a constant for the given value.static Constof(short value) Returns a constant for the given value.static ConstReturns a constant for the given value.static ConstReturns a constant for the given value.static ConstReturns a constant for the given value.static ConstReturns a constant for the given value.static ConstReturns a constant for the given value.static ConstReturns a constant for the given Constable.static Constof(ConstantDesc constantDesc) Returns a constant for the given description.static Constof(DynamicConstantDesc<?> dcd) Returns a constant for the given description.static Constof(MethodHandleDesc desc) Returns a method handle constant from the given descriptor.static Constof(MethodTypeDesc desc) Returns a method type constant from the given descriptor.static ConstReturns a constant for the given value.static Constof(Enum.EnumDesc<?> value) Returns a constant for the given value.static ConstReturns a constant for the given value.static ConstReturns a constant for the given value.static Constof(VarHandle.VarHandleDesc value) Returns a constant for the given value.static ConstReturns a constant for the given value.static ConstReturns a constant for the given value.static ConstReturns a constant for the given value.static ConstReturns a list constant containing the given items.static ConstReturns a map entry constant with the key and value of the given entry.static ConstReturns a map constant containing the given items.static ConstReturns a set constant containing the given items.static ConstofArrayVarHandle(ClassDesc arrayType) Returns aVarHandleconstant for the given array type.static ConstReturns a method handle constant from the given constructor descriptor.static ConstReturns a constant with the default value of giventype.static ConstReturns a constant with the default value of giventype.static ConstReturns a method handle for an instance field getter.static ConstReturns a method handle for an instance field setter.static ConstofFieldVarHandle(FieldDesc desc) Returns aVarHandleconstant for the given instance field.static ConstReturns a constant whose value is the result of a one-time method invocation.static ConstReturns a constant whose value is the result of a one-time method invocation.static ConstofMethodHandle(InvokeKind kind, MethodDesc desc) Returns a method handle constant from the given information.static ConstReturns anullconstant with the given type.static ConstReturns anullconstant with the given type.static ConstReturns a method handle for a static field getter.static ConstReturns a method handle for a static field setter.static ConstReturns aVarHandleconstant for the given static field.static ConstofStaticFinalField(FieldDesc desc) Returns a constant with the value of the givenstatic finalfield.static ConstofVoid()Returns thevoidconstant.Methods inherited from interface Constable
describeConstableMethods inherited from interface Expr
elem, elem, elem, field, field, field, field, genericType, hasGenericType, length, typeMethods inherited from interface SimpleTyped
isPrimitive, isVoid, slotSize, typeKind
-
Method Details
-
desc
ConstantDesc desc()Returns the description of the constant.- Returns:
- the description of the constant
-
of
-
of
Returns a constant for the given description.- Parameters:
constantDesc- the object to create a constant from (must not benull)- Returns:
- a constant for the given description
-
of
Returns a constant for the given description.- Parameters:
dcd- the object to create a constant from (must not benull)- Returns:
- a constant for the given description
-
ofNull
-
ofNull
-
ofDefault
-
ofDefault
-
of
-
of
-
of
Returns a constant for the given value.- Parameters:
value- the value to create a constant from (must not benull)- Returns:
- a constant for the given value
-
of
Returns a constant for the given value.- Parameters:
value- the value to create a constant from (must not benull)- Returns:
- a constant for the given value
-
of
-
of
Returns a constant for the given value.- Parameters:
value- the value to create a constant from- Returns:
- a constant for the given value
-
of
-
of
Returns a constant for the given value.- Parameters:
value- the value to create a constant from- Returns:
- a constant for the given value
-
of
-
of
Returns a constant for the given value.- Parameters:
value- the value to create a constant from- Returns:
- a constant for the given value
-
of
-
of
Returns a constant for the given value.- Parameters:
value- the value to create a constant from- Returns:
- a constant for the given value
-
of
-
of
Returns a constant for the given value.- Parameters:
value- the value to create a constant from- Returns:
- a constant for the given value
-
of
-
of
Returns a constant for the given value.- Parameters:
value- the value to create a constant from- Returns:
- a constant for the given value
-
of
-
of
Returns a constant for the given value.- Parameters:
value- the value to create a constant from- Returns:
- a constant for the given value
-
of
-
of
Returns a constant for the given value.- Parameters:
value- the value to create a constant from- Returns:
- a constant for the given value
-
of
-
of
-
of
-
of
-
of
-
ofVoid
-
ofFieldVarHandle
-
ofStaticFieldVarHandle
-
ofStaticFinalField
-
ofArrayVarHandle
-
ofInvoke
Returns a constant whose value is the result of a one-time method invocation. Note that due to the nature of dynamic constants, parallel threads may cause the method to be invoked more than once.- Parameters:
methodHandle- the method handle to invoke (must not benull)args- the list of arguments (must not benull)- Returns:
- a constant whose value is the result of a one-time method invocation
-
ofInvoke
Returns a constant whose value is the result of a one-time method invocation. Note that due to the nature of dynamic constants, parallel threads may cause the method to be invoked more than once.- Parameters:
methodHandle- the method handle to invoke (must not benull)args- the list of arguments (must not benull)- Returns:
- a constant whose value is the result of a one-time method invocation
-
of
Returns a method handle constant from the given descriptor.- Parameters:
desc- the method handle descriptor (must not benull)- Returns:
- a method handle constant from the given descriptor
-
ofMethodHandle
Returns a method handle constant from the given information.- Parameters:
kind- the invocation kind (must not benull)desc- the method's descriptor (must not benull)- Returns:
- a method handle constant from the given information
-
ofConstructorMethodHandle
Returns a method handle constant from the given constructor descriptor.- Parameters:
desc- the constructor descriptor (must not benull)- Returns:
- a method handle constant from the given constructor descriptor
-
ofFieldSetterMethodHandle
-
ofFieldGetterMethodHandle
-
ofStaticFieldSetterMethodHandle
-
ofStaticFieldGetterMethodHandle
-
of
Returns a method type constant from the given descriptor.- Parameters:
desc- the method type descriptor (must not benull)- Returns:
- a method type constant from the given descriptor
-
of
Returns a list constant containing the given items. The maximum number of items is around 254 (depending on the constant type); however, this method should only be used for relatively short lists to avoid overfilling the constant pool. Note that the JDK immutable collection types forbidnull, sonullvalues should not be used.- Parameters:
items- the list of items, which must beConst,Constable, orConstantDescsubtypes (must not benull)- Returns:
- a list constant containing the given items
-
of
Returns a set constant containing the given items. The maximum number of items is around 254 (depending on the constant type); however, this method should only be used for relatively small sets to avoid overfilling the constant pool. Note that the JDK immutable collection types forbidnull, sonullvalues should not be used.- Parameters:
items- the set of items, which must beConst,Constable, orConstantDescsubtypes (must not benull)- Returns:
- a set constant containing the given items
-
of
Returns a map constant containing the given items. The maximum number of items is around 254 (depending on the constant type); however, this method should only be used for relatively small maps to avoid overfilling the constant pool. Note that the JDK immutable collection types forbidnull, sonullvalues should not be used.- Parameters:
items- the set of items, which must beConst,Constable, orConstantDescsubtypes (must not benull)- Returns:
- a map constant containing the given items
-
of
Returns a map entry constant with the key and value of the given entry.- Parameters:
entry- the map entry containing a constant key and value, which must beConst,Constable, orConstantDescsubtypes (must not benull)- Returns:
- a map entry constant with the key and value of the given entry
-