Package net.bytebuddy.utility
Class ConstantValue.Simple
- java.lang.Object
-
- net.bytebuddy.utility.ConstantValue.Simple
-
- All Implemented Interfaces:
ConstantValue
- Enclosing interface:
- ConstantValue
@Enhance public static class ConstantValue.Simple extends java.lang.Object implements ConstantValue
A simple representation of a constant value.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface net.bytebuddy.utility.ConstantValue
ConstantValue.Simple
-
-
Field Summary
Fields Modifier and Type Field Description private StackManipulation
stackManipulation
A stack manipulation that loads a constant.private TypeDescription
typeDescription
The description of the constant value's type.
-
Constructor Summary
Constructors Modifier Constructor Description protected
Simple(StackManipulation stackManipulation, TypeDescription typeDescription)
Creates a simple constant value.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description TypeDescription
getTypeDescription()
Returns a description of the type of this constant.StackManipulation
toStackManipulation()
Returns a stack manipulation loading this value.static ConstantValue
wrap(java.lang.Object value)
Returns a constant value for the supplied constant value.static ConstantValue
wrapOrNull(java.lang.Object value)
Returns a constant value for the supplied constant value.
-
-
-
Field Detail
-
stackManipulation
private final StackManipulation stackManipulation
A stack manipulation that loads a constant.
-
typeDescription
private final TypeDescription typeDescription
The description of the constant value's type.
-
-
Constructor Detail
-
Simple
protected Simple(StackManipulation stackManipulation, TypeDescription typeDescription)
Creates a simple constant value.- Parameters:
stackManipulation
- A stack manipulation that loads a constant.typeDescription
- The description of the constant value's type.
-
-
Method Detail
-
wrap
public static ConstantValue wrap(java.lang.Object value)
Returns a constant value for the supplied constant value.- Parameters:
value
- The value to represent as a constant.- Returns:
- An appropriate representation of the constant value.
-
wrapOrNull
@MaybeNull public static ConstantValue wrapOrNull(java.lang.Object value)
Returns a constant value for the supplied constant value.- Parameters:
value
- The value to represent as a constant.- Returns:
- An appropriate representation of the constant value or
null
if the supplied value is not representable as a compile-time constant.
-
getTypeDescription
public TypeDescription getTypeDescription()
Returns a description of the type of this constant.- Specified by:
getTypeDescription
in interfaceConstantValue
- Returns:
- A description of the type of this constant.
-
toStackManipulation
public StackManipulation toStackManipulation()
Returns a stack manipulation loading this value.- Specified by:
toStackManipulation
in interfaceConstantValue
- Returns:
- A stack manipulation loading this value.
-
-