public abstract class Value extends Object
Modifier and Type | Class and Description |
---|---|
static class |
Value.Discriminator
Marker for the type of the contained value of a Value instance.
|
private static class |
Value.DoubleValue |
private static class |
Value.LongValue |
private static class |
Value.StringValue |
Modifier and Type | Field and Description |
---|---|
private static String |
UNSUPPORTED_VALUE_TYPE |
Constructor and Description |
---|
Value() |
Modifier and Type | Method and Description |
---|---|
double |
doubleValue()
Get the double wrapped by a Value if one exists.
|
abstract Value.Discriminator |
getType()
Show the (single) supported standard type representation of a Value instance.
|
long |
longValue()
Get the long wrapped by a Value if one exists.
|
static Value |
of(double value)
Helper method to wrap a double as a Value.
|
static Value |
of(long value)
Helper method to wrap a long as a Value.
|
static Value |
of(String value)
Helper method to wrap a string as a Value.
|
String |
stringValue()
Get the string wrapped by a Value if one exists.
|
private static final String UNSUPPORTED_VALUE_TYPE
public long longValue() throws UnsupportedOperationException
UnsupportedOperationException
- if LONG is not returned by {getType()
.public double doubleValue() throws UnsupportedOperationException
UnsupportedOperationException
- if DOUBLE is not returned by {getType()
.public String stringValue() throws UnsupportedOperationException
UnsupportedOperationException
- if STRING is not returned by {getType()
.public abstract Value.Discriminator getType()
public static Value of(long value)
value
- the value to wrappublic static Value of(double value)
value
- the value to wrapCopyright © 2018. All rights reserved.