Package net.bytebuddy.utility
Class JavaConstant.Simple.OfTrivialValue<S>
java.lang.Object
net.bytebuddy.utility.JavaConstant.Simple<S>
net.bytebuddy.utility.JavaConstant.Simple.OfTrivialValue<S>
- Type Parameters:
S
- The represented type.
- All Implemented Interfaces:
ConstantValue
,JavaConstant
- Direct Known Subclasses:
JavaConstant.Simple.OfTrivialValue.ForDouble
,JavaConstant.Simple.OfTrivialValue.ForFloat
,JavaConstant.Simple.OfTrivialValue.ForInteger
,JavaConstant.Simple.OfTrivialValue.ForLong
,JavaConstant.Simple.OfTrivialValue.ForString
- Enclosing class:
JavaConstant.Simple<T>
protected abstract static class JavaConstant.Simple.OfTrivialValue<S>
extends JavaConstant.Simple<S>
Represents a trivial constant value that represents itself.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static class
protected static class
protected static class
protected static class
protected static class
Nested classes/interfaces inherited from class net.bytebuddy.utility.JavaConstant.Simple
JavaConstant.Simple.Dispatcher, JavaConstant.Simple.OfTrivialValue<S>, JavaConstant.Simple.OfTypeDescription
Nested classes/interfaces inherited from interface net.bytebuddy.utility.JavaConstant
JavaConstant.Dynamic, JavaConstant.MethodHandle, JavaConstant.MethodType, JavaConstant.Simple<T>, JavaConstant.Visitor<T>
-
Field Summary
Fields inherited from class net.bytebuddy.utility.JavaConstant.Simple
CLASS_DESC, CONSTANT_DESC, DIRECT_METHOD_HANDLE_DESC, DIRECT_METHOD_HANDLE_DESC_KIND, DYNAMIC_CONSTANT_DESC, METHOD_HANDLE_DESC, METHOD_TYPE_DESC, value
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
OfTrivialValue
(S value, TypeDescription typeDescription) Creates a representation of a trivial constant that represents itself. -
Method Summary
Modifier and TypeMethodDescription<T> T
accept
(JavaConstant.Visitor<T> visitor) Applies the supplied visitor to this constant type with its respective callback.Returns this constant as a Javajava.lang.constant.ConstantDesc
if the current VM is of at least version 12.Methods inherited from class net.bytebuddy.utility.JavaConstant.Simple
equals, getTypeDescription, getValue, hashCode, of, ofAsm, ofDescription, ofDescription, ofDescription, ofLoaded, ofLoadedOrNull, toString, wrap, wrap
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface net.bytebuddy.utility.ConstantValue
toStackManipulation
-
Constructor Details
-
OfTrivialValue
Creates a representation of a trivial constant that represents itself.- Parameters:
value
- The represented value.typeDescription
- The represented value's type.
-
-
Method Details
-
toDescription
Returns this constant as a Javajava.lang.constant.ConstantDesc
if the current VM is of at least version 12. If the current VM is of an older version and does not support the type, an exception is thrown.- Returns:
- This constant as a Java
java.lang.constant.ConstantDesc
.
-
accept
Applies the supplied visitor to this constant type with its respective callback.- Type Parameters:
T
- The type of the value that is returned by the visitor.- Parameters:
visitor
- The visitor to dispatch.- Returns:
- The value that is returned by the supplied visitor.
-