-
- All Implemented Interfaces:
-
com.batch.android.msgpack.value.FloatValue,com.batch.android.msgpack.value.ImmutableFloatValue,com.batch.android.msgpack.value.ImmutableNumberValue,com.batch.android.msgpack.value.ImmutableValue,com.batch.android.msgpack.value.NumberValue,com.batch.android.msgpack.value.Value
public class ImmutableDoubleValueImpl extends AbstractImmutableValue implements ImmutableFloatValue
{@code ImmutableDoubleValueImpl}Implements{@code ImmutableFloatValue}using a{@code double}field.
-
-
Constructor Summary
Constructors Constructor Description ImmutableDoubleValueImpl(double value)
-
Method Summary
Modifier and Type Method Description ValueTypegetValueType()Returns type of this value. ImmutableDoubleValueImplimmutableValue()Returns immutable copy of this value. ImmutableNumberValueasNumberValue()Returns the value as {@code NumberValue}.ImmutableFloatValueasFloatValue()Returns the value as {@code FloatValue}.bytetoByte()Represent this value as a byte value, which may involve rounding or truncation of the original value.the value. shorttoShort()Represent this value as a short value, which may involve rounding or truncation of the original value. inttoInt()Represent this value as an int value, which may involve rounding or truncation of the original value.value. longtoLong()Represent this value as a long value, which may involve rounding or truncation of the original value. BigIntegertoBigInteger()Represent this value as a BigInteger, which may involve rounding or truncation of the original value. floattoFloat()Represent this value as a 32-bit float value, which may involve rounding or truncation of the original value. doubletoDouble()Represent this value as a 64-bit double value, which may involve rounding or truncation of the original value. voidwriteTo(MessagePacker pk)Serializes the value using the specified {@code MessagePacker}booleanequals(Object o)inthashCode()StringtoJson()Returns json representation of this Value. StringtoString()-
Methods inherited from class com.batch.android.msgpack.value.impl.AbstractImmutableValue
asArrayValue, asBinaryValue, asBooleanValue, asExtensionValue, asIntegerValue, asMapValue, asNilValue, asRawValue, asStringValue, isArrayValue, isBinaryValue, isBooleanValue, isExtensionValue, isFloatValue, isIntegerValue, isMapValue, isNilValue, isNumberValue, isRawValue, isStringValue -
Methods inherited from class com.batch.android.msgpack.value.Value
asArrayValue, asBinaryValue, asBooleanValue, asExtensionValue, asFloatValue, asIntegerValue, asMapValue, asNilValue, asNumberValue, asRawValue, asStringValue, equals, immutableValue -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Method Detail
-
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.
-
immutableValue
ImmutableDoubleValueImpl immutableValue()
Returns immutable copy of this value.
This method simply returns
thiswithout copying the value if this value is already immutable.
-
asNumberValue
ImmutableNumberValue 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.
-
asFloatValue
ImmutableFloatValue 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.
-
toByte
byte toByte()
Represent this value as a byte value, which may involve rounding or truncation of the original value.the value.
-
toShort
short toShort()
Represent this value as a short value, which may involve rounding or truncation of the original value.
-
toInt
int toInt()
Represent this value as an int value, which may involve rounding or truncation of the original value.value.
-
toLong
long toLong()
Represent this value as a long value, which may involve rounding or truncation of the original value.
-
toBigInteger
BigInteger toBigInteger()
Represent this value as a BigInteger, which may involve rounding or truncation of the original value.
-
toFloat
float toFloat()
Represent this value as a 32-bit float value, which may involve rounding or truncation of the original value.
-
toDouble
double toDouble()
Represent this value as a 64-bit double value, which may involve rounding or truncation of the original value.
-
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
-
-
-
-