-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public enumVariable.Type
-
Constructor Summary
Constructors Constructor Description Variable()
-
Method Summary
Modifier and Type Method Description VariablesetNilValue()VariablesetBooleanValue(boolean v)VariablesetIntegerValue(long v)VariablesetIntegerValue(BigInteger v)VariablesetFloatValue(double v)VariablesetFloatValue(float v)VariablesetBinaryValue(Array<byte> v)VariablesetStringValue(String v)VariablesetStringValue(Array<byte> v)VariablesetArrayValue(List<Value> v)VariablesetMapValue(Map<Value, Value> v)VariablesetExtensionValue(byte type, Array<byte> data)ImmutableValueimmutableValue()Returns immutable copy of this value. voidwriteTo(MessagePacker pk)Serializes the value using the specified {@code MessagePacker}inthashCode()booleanequals(Object o)StringtoJson()Returns json representation of this Value. StringtoString()ValueTypegetValueType()Returns type of this value. booleanisNilValue()Returns true if type of this value is Nil. booleanisBooleanValue()Returns true if type of this value is Boolean. booleanisNumberValue()Returns true if type of this value is Integer or Float. booleanisIntegerValue()Returns true if type of this value is Integer. booleanisFloatValue()Returns true if type of this value is Float. booleanisRawValue()Returns true if type of this value is String or Binary. booleanisBinaryValue()Returns true if type of this value is Binary. booleanisStringValue()Returns true if type of this value is String. booleanisArrayValue()Returns true if type of this value is Array. booleanisMapValue()Returns true if type of this value is Map. booleanisExtensionValue()Returns true if type of this an Extension. NilValueasNilValue()Returns the value as {@code NilValue}.BooleanValueasBooleanValue()Returns the value as {@code BooleanValue}.NumberValueasNumberValue()Returns the value as {@code NumberValue}.IntegerValueasIntegerValue()Returns the value as {@code IntegerValue}.FloatValueasFloatValue()Returns the value as {@code FloatValue}.RawValueasRawValue()Returns the value as {@code RawValue}.BinaryValueasBinaryValue()Returns the value as {@code BinaryValue}.StringValueasStringValue()Returns the value as {@code StringValue}.ArrayValueasArrayValue()Returns the value as {@code ArrayValue}.MapValueasMapValue()Returns the value as {@code MapValue}.ExtensionValueasExtensionValue()Returns the value as {@code ExtensionValue}.-
-
Method Detail
-
setNilValue
Variable setNilValue()
-
setBooleanValue
Variable setBooleanValue(boolean v)
-
setIntegerValue
Variable setIntegerValue(long v)
-
setIntegerValue
Variable setIntegerValue(BigInteger v)
-
setFloatValue
Variable setFloatValue(double v)
-
setFloatValue
Variable setFloatValue(float v)
-
setBinaryValue
Variable setBinaryValue(Array<byte> v)
-
setStringValue
Variable setStringValue(String v)
-
setStringValue
Variable setStringValue(Array<byte> v)
-
setArrayValue
Variable setArrayValue(List<Value> v)
-
setMapValue
Variable setMapValue(Map<Value, Value> v)
-
setExtensionValue
Variable setExtensionValue(byte type, Array<byte> data)
-
immutableValue
ImmutableValue immutableValue()
Returns immutable copy of this value.
This method simply returns
thiswithout copying the value if this value is already immutable.
-
writeTo
void writeTo(MessagePacker pk)
Serializes the value using the specified
{@code MessagePacker}
-
hashCode
int hashCode()
-
toJson
String toJson()
Returns json representation of this Value.
Following behavior is not configurable at this release and they might be changed at future releases:
- if a key of MapValue is not string, the key is converted to a string using toString method.
- NaN and Infinity of DoubleValue are converted to null.
- ExtensionValue is converted to a 2-element array where first element is a number and second element is the data encoded in hex.
- BinaryValue is converted to a string using UTF-8 encoding. Invalid byte sequence is replaced with
U+FFFD replacement character. - Invalid UTF-8 byte sequences in StringValue is replaced with
U+FFFD replacement character
-
getValueType
ValueType getValueType()
Returns type of this value.
Note that you can't use
instanceofto check type of a value because type of a mutable value is variable.
-
isNilValue
boolean isNilValue()
Returns true if type of this value is Nil.
If this method returns true,
{@code asNilValue}never throws exceptions.Note that you can't useinstanceofor cast((NilValue) thisValue)to check type of a value because type of a mutable value is variable.
-
isBooleanValue
boolean isBooleanValue()
Returns true if type of this value is Boolean.
If this method returns true,
{@code asBooleanValue}never throws exceptions.Note that you can't useinstanceofor cast((BooleanValue) thisValue)to check type of a value because type of a mutable value is variable.
-
isNumberValue
boolean isNumberValue()
Returns true if type of this value is Integer or Float.
If this method returns true,
{@code asNumberValue}never throws exceptions.Note that you can't useinstanceofor cast((NumberValue) thisValue)to check type of a value because type of a mutable value is variable.
-
isIntegerValue
boolean isIntegerValue()
Returns true if type of this value is Integer.
If this method returns true,
{@code asIntegerValue}never throws exceptions.Note that you can't useinstanceofor cast((IntegerValue) thisValue)to check type of a value because type of a mutable value is variable.
-
isFloatValue
boolean isFloatValue()
Returns true if type of this value is Float.
If this method returns true,
{@code asFloatValue}never throws exceptions.Note that you can't useinstanceofor cast((FloatValue) thisValue)to check type of a value because type of a mutable value is variable.
-
isRawValue
boolean isRawValue()
Returns true if type of this value is String or Binary.
If this method returns true,
{@code asRawValue}never throws exceptions.Note that you can't useinstanceofor cast((RawValue) thisValue)to check type of a value because type of a mutable value is variable.
-
isBinaryValue
boolean isBinaryValue()
Returns true if type of this value is Binary.
If this method returns true,
{@code asBinaryValue}never throws exceptions.Note that you can't useinstanceofor cast((BinaryValue) thisValue)to check type of a value because type of a mutable value is variable.
-
isStringValue
boolean isStringValue()
Returns true if type of this value is String.
If this method returns true,
{@code asStringValue}never throws exceptions.Note that you can't useinstanceofor cast((StringValue) thisValue)to check type of a value because type of a mutable value is variable.
-
isArrayValue
boolean isArrayValue()
Returns true if type of this value is Array.
If this method returns true,
{@code asArrayValue}never throws exceptions.Note that you can't useinstanceofor cast((ArrayValue) thisValue)to check type of a value because type of a mutable value is variable.
-
isMapValue
boolean isMapValue()
Returns true if type of this value is Map.
If this method returns true,
{@code asMapValue}never throws exceptions.Note that you can't useinstanceofor cast((MapValue) thisValue)to check type of a value because type of a mutable value is variable.
-
isExtensionValue
boolean isExtensionValue()
Returns true if type of this an Extension.
If this method returns true,
{@code asExtensionValue}never throws exceptions.Note that you can't useinstanceofor cast((ExtensionValue) thisValue)to check type of a value becausetype of a mutable value is variable.
-
asNilValue
NilValue asNilValue()
Returns the value as
{@code NilValue}. Otherwise throws{@code MessageTypeCastException}.Note that you can't use
instanceofor cast((NilValue) thisValue)to check type of a value because type of a mutable value is variable.
-
asBooleanValue
BooleanValue asBooleanValue()
Returns the value as
{@code BooleanValue}. Otherwise throws{@code MessageTypeCastException}.Note that you can't use
instanceofor cast((BooleanValue) thisValue)to check type of a value because type of a mutable value is variable.
-
asNumberValue
NumberValue asNumberValue()
Returns the value as
{@code NumberValue}. Otherwise throws{@code MessageTypeCastException}.Note that you can't use
instanceofor cast((NumberValue) thisValue)to check type of a value because type of a mutable value is variable.
-
asIntegerValue
IntegerValue asIntegerValue()
Returns the value as
{@code IntegerValue}. Otherwise throws{@code MessageTypeCastException}.Note that you can't use
instanceofor cast((IntegerValue) thisValue)to check type of a value because type of a mutable value is variable.
-
asFloatValue
FloatValue asFloatValue()
Returns the value as
{@code FloatValue}. Otherwise throws{@code MessageTypeCastException}.Note that you can't use
instanceofor cast((FloatValue) thisValue)to check type of a value because type of a mutable value is variable.
-
asRawValue
RawValue asRawValue()
Returns the value as
{@code RawValue}. Otherwise throws{@code MessageTypeCastException}.Note that you can't use
instanceofor cast((RawValue) thisValue)to check type of a value because type of a mutable value is variable.
-
asBinaryValue
BinaryValue asBinaryValue()
Returns the value as
{@code BinaryValue}. Otherwise throws{@code MessageTypeCastException}.Note that you can't use
instanceofor cast((BinaryValue) thisValue)to check type of a value because type of a mutable value is variable.
-
asStringValue
StringValue asStringValue()
Returns the value as
{@code StringValue}. Otherwise throws{@code MessageTypeCastException}.Note that you can't use
instanceofor cast((StringValue) thisValue)to check type of a value because type of a mutable value is variable.
-
asArrayValue
ArrayValue asArrayValue()
Returns the value as
{@code ArrayValue}. Otherwise throws{@code MessageTypeCastException}.Note that you can't use
instanceofor cast((ArrayValue) thisValue)to check type of a value because type of a mutable value is variable.
-
asMapValue
MapValue asMapValue()
Returns the value as
{@code MapValue}. Otherwise throws{@code MessageTypeCastException}.Note that you can't use
instanceofor cast((MapValue) thisValue)to check type of a value because type of a mutable value is variable.
-
asExtensionValue
ExtensionValue asExtensionValue()
Returns the value as
{@code ExtensionValue}. Otherwise throws{@code MessageTypeCastException}.Note that you can't use
instanceofor cast((ExtensionValue) thisValue)to check type of a valuebecause type of a mutable value is variable.
-
-
-
-