Package org.msgpack.value.impl
Class ImmutableDoubleValueImpl
- java.lang.Object
-
- org.msgpack.value.impl.ImmutableDoubleValueImpl
-
- All Implemented Interfaces:
FloatValue,ImmutableFloatValue,ImmutableNumberValue,ImmutableValue,NumberValue,Value
public class ImmutableDoubleValueImpl extends java.lang.Object implements ImmutableFloatValue
ImmutableDoubleValueImplImplementsImmutableFloatValueusing adoublefield.- See Also:
FloatValue
-
-
Constructor Summary
Constructors Constructor Description ImmutableDoubleValueImpl(double value)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ImmutableArrayValueasArrayValue()Returns the value asArrayValue.ImmutableBinaryValueasBinaryValue()Returns the value asBinaryValue.ImmutableBooleanValueasBooleanValue()Returns the value asBooleanValue.ImmutableExtensionValueasExtensionValue()Returns the value asExtensionValue.ImmutableFloatValueasFloatValue()Returns the value asFloatValue.ImmutableIntegerValueasIntegerValue()Returns the value asIntegerValue.ImmutableMapValueasMapValue()Returns the value asMapValue.ImmutableNilValueasNilValue()Returns the value asNilValue.ImmutableNumberValueasNumberValue()Returns the value asNumberValue.ImmutableRawValueasRawValue()Returns the value asRawValue.ImmutableStringValueasStringValue()Returns the value asStringValue.booleanequals(java.lang.Object o)Compares this value to the specified object.ValueTypegetValueType()Returns type of this value.inthashCode()ImmutableDoubleValueImplimmutableValue()Returns immutable copy of this value.booleanisArrayValue()Returns true if type of this value is Array.booleanisBinaryValue()Returns true if type of this value is Binary.booleanisBooleanValue()Returns true if type of this value is Boolean.booleanisExtensionValue()Returns true if type of this an Extension.booleanisFloatValue()Returns true if type of this value is Float.booleanisIntegerValue()Returns true if type of this value is Integer.booleanisMapValue()Returns true if type of this value is Map.booleanisNilValue()Returns true if type of this value is Nil.booleanisNumberValue()Returns true if type of this value is Integer or Float.booleanisRawValue()Returns true if type of this value is String or Binary.booleanisStringValue()Returns true if type of this value is String.java.math.BigIntegertoBigInteger()Represent this value as a BigInteger, which may involve rounding or truncation of the original value.bytetoByte()Represent this value as a byte 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.floattoFloat()Represent this value as a 32-bit float 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.java.lang.StringtoJson()Returns json representation of this Value.longtoLong()Represent this value as a long value, which may involve rounding or truncation of the original value.shorttoShort()Represent this value as a short value, which may involve rounding or truncation of the original value.java.lang.StringtoString()voidwriteTo(MessagePacker pk)Serializes the value using the specifiedMessagePacker-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.msgpack.value.ImmutableValue
asArrayValue, asBinaryValue, asBooleanValue, asIntegerValue, asMapValue, asNilValue, asRawValue, asStringValue
-
Methods inherited from interface org.msgpack.value.Value
asExtensionValue, isArrayValue, isBinaryValue, isBooleanValue, isExtensionValue, isFloatValue, isIntegerValue, isMapValue, isNilValue, isNumberValue, isRawValue, isStringValue
-
-
-
-
Method Detail
-
getValueType
public ValueType getValueType()
Description copied from interface:ValueReturns type of this value. Note that you can't useinstanceofto check type of a value because type of a mutable value is variable.- Specified by:
getValueTypein interfaceValue
-
immutableValue
public ImmutableDoubleValueImpl immutableValue()
Description copied from interface:ValueReturns immutable copy of this value. This method simply returnsthiswithout copying the value if this value is already immutable.- Specified by:
immutableValuein interfaceValue
-
asNumberValue
public ImmutableNumberValue asNumberValue()
Description copied from interface:ValueReturns the value asNumberValue. Otherwise throwsMessageTypeCastException. Note that you can't useinstanceofor cast((NumberValue) thisValue)to check type of a value because type of a mutable value is variable.- Specified by:
asNumberValuein interfaceValue
-
asFloatValue
public ImmutableFloatValue asFloatValue()
Description copied from interface:ValueReturns the value asFloatValue. Otherwise throwsMessageTypeCastException. Note that you can't useinstanceofor cast((FloatValue) thisValue)to check type of a value because type of a mutable value is variable.- Specified by:
asFloatValuein interfaceImmutableValue- Specified by:
asFloatValuein interfaceValue
-
toByte
public byte toByte()
Description copied from interface:NumberValueRepresent this value as a byte value, which may involve rounding or truncation of the original value. the value.- Specified by:
toBytein interfaceNumberValue
-
toShort
public short toShort()
Description copied from interface:NumberValueRepresent this value as a short value, which may involve rounding or truncation of the original value.- Specified by:
toShortin interfaceNumberValue
-
toInt
public int toInt()
Description copied from interface:NumberValueRepresent this value as an int value, which may involve rounding or truncation of the original value. value.- Specified by:
toIntin interfaceNumberValue
-
toLong
public long toLong()
Description copied from interface:NumberValueRepresent this value as a long value, which may involve rounding or truncation of the original value.- Specified by:
toLongin interfaceNumberValue
-
toBigInteger
public java.math.BigInteger toBigInteger()
Description copied from interface:NumberValueRepresent this value as a BigInteger, which may involve rounding or truncation of the original value.- Specified by:
toBigIntegerin interfaceNumberValue
-
toFloat
public float toFloat()
Description copied from interface:NumberValueRepresent this value as a 32-bit float value, which may involve rounding or truncation of the original value.- Specified by:
toFloatin interfaceNumberValue
-
toDouble
public double toDouble()
Description copied from interface:NumberValueRepresent this value as a 64-bit double value, which may involve rounding or truncation of the original value.- Specified by:
toDoublein interfaceNumberValue
-
writeTo
public void writeTo(MessagePacker pk) throws java.io.IOException
Description copied from interface:ValueSerializes the value using the specifiedMessagePacker- Specified by:
writeToin interfaceValue- Throws:
java.io.IOException- See Also:
MessagePacker
-
equals
public boolean equals(java.lang.Object o)
Description copied from interface:ValueCompares this value to the specified object. This method returnstrueif type and value are equivalent. If this value isMapValueorArrayValue, this method check equivalence of elements recursively.
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toJson
public java.lang.String toJson()
Description copied from interface:ValueReturns 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
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
isNilValue
public boolean isNilValue()
Description copied from interface:ValueReturns true if type of this value is Nil. If this method returns true,asNilValuenever 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.- Specified by:
isNilValuein interfaceValue
-
isBooleanValue
public boolean isBooleanValue()
Description copied from interface:ValueReturns true if type of this value is Boolean. If this method returns true,asBooleanValuenever 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.- Specified by:
isBooleanValuein interfaceValue
-
isNumberValue
public boolean isNumberValue()
Description copied from interface:ValueReturns true if type of this value is Integer or Float. If this method returns true,asNumberValuenever 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.- Specified by:
isNumberValuein interfaceValue
-
isIntegerValue
public boolean isIntegerValue()
Description copied from interface:ValueReturns true if type of this value is Integer. If this method returns true,asIntegerValuenever 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.- Specified by:
isIntegerValuein interfaceValue
-
isFloatValue
public boolean isFloatValue()
Description copied from interface:ValueReturns true if type of this value is Float. If this method returns true,asFloatValuenever 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.- Specified by:
isFloatValuein interfaceValue
-
isRawValue
public boolean isRawValue()
Description copied from interface:ValueReturns true if type of this value is String or Binary. If this method returns true,asRawValuenever 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.- Specified by:
isRawValuein interfaceValue
-
isBinaryValue
public boolean isBinaryValue()
Description copied from interface:ValueReturns true if type of this value is Binary. If this method returns true,asBinaryValuenever 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.- Specified by:
isBinaryValuein interfaceValue
-
isStringValue
public boolean isStringValue()
Description copied from interface:ValueReturns true if type of this value is String. If this method returns true,asStringValuenever 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.- Specified by:
isStringValuein interfaceValue
-
isArrayValue
public boolean isArrayValue()
Description copied from interface:ValueReturns true if type of this value is Array. If this method returns true,asArrayValuenever 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.- Specified by:
isArrayValuein interfaceValue
-
isMapValue
public boolean isMapValue()
Description copied from interface:ValueReturns true if type of this value is Map. If this method returns true,asMapValuenever 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.- Specified by:
isMapValuein interfaceValue
-
isExtensionValue
public boolean isExtensionValue()
Description copied from interface:ValueReturns true if type of this an Extension. If this method returns true,asExtensionValuenever throws exceptions. Note that you can't useinstanceofor cast((ExtensionValue) thisValue)to check type of a value because type of a mutable value is variable.- Specified by:
isExtensionValuein interfaceValue
-
asNilValue
public ImmutableNilValue asNilValue()
Description copied from interface:ValueReturns the value asNilValue. Otherwise throwsMessageTypeCastException. Note that you can't useinstanceofor cast((NilValue) thisValue)to check type of a value because type of a mutable value is variable.- Specified by:
asNilValuein interfaceImmutableValue- Specified by:
asNilValuein interfaceValue
-
asBooleanValue
public ImmutableBooleanValue asBooleanValue()
Description copied from interface:ValueReturns the value asBooleanValue. Otherwise throwsMessageTypeCastException. Note that you can't useinstanceofor cast((BooleanValue) thisValue)to check type of a value because type of a mutable value is variable.- Specified by:
asBooleanValuein interfaceImmutableValue- Specified by:
asBooleanValuein interfaceValue
-
asIntegerValue
public ImmutableIntegerValue asIntegerValue()
Description copied from interface:ValueReturns the value asIntegerValue. Otherwise throwsMessageTypeCastException. Note that you can't useinstanceofor cast((IntegerValue) thisValue)to check type of a value because type of a mutable value is variable.- Specified by:
asIntegerValuein interfaceImmutableValue- Specified by:
asIntegerValuein interfaceValue
-
asRawValue
public ImmutableRawValue asRawValue()
Description copied from interface:ValueReturns the value asRawValue. Otherwise throwsMessageTypeCastException. Note that you can't useinstanceofor cast((RawValue) thisValue)to check type of a value because type of a mutable value is variable.- Specified by:
asRawValuein interfaceImmutableValue- Specified by:
asRawValuein interfaceValue
-
asBinaryValue
public ImmutableBinaryValue asBinaryValue()
Description copied from interface:ValueReturns the value asBinaryValue. Otherwise throwsMessageTypeCastException. Note that you can't useinstanceofor cast((BinaryValue) thisValue)to check type of a value because type of a mutable value is variable.- Specified by:
asBinaryValuein interfaceImmutableValue- Specified by:
asBinaryValuein interfaceValue
-
asStringValue
public ImmutableStringValue asStringValue()
Description copied from interface:ValueReturns the value asStringValue. Otherwise throwsMessageTypeCastException. Note that you can't useinstanceofor cast((StringValue) thisValue)to check type of a value because type of a mutable value is variable.- Specified by:
asStringValuein interfaceImmutableValue- Specified by:
asStringValuein interfaceValue
-
asArrayValue
public ImmutableArrayValue asArrayValue()
Description copied from interface:ValueReturns the value asArrayValue. Otherwise throwsMessageTypeCastException. Note that you can't useinstanceofor cast((ArrayValue) thisValue)to check type of a value because type of a mutable value is variable.- Specified by:
asArrayValuein interfaceImmutableValue- Specified by:
asArrayValuein interfaceValue
-
asMapValue
public ImmutableMapValue asMapValue()
Description copied from interface:ValueReturns the value asMapValue. Otherwise throwsMessageTypeCastException. Note that you can't useinstanceofor cast((MapValue) thisValue)to check type of a value because type of a mutable value is variable.- Specified by:
asMapValuein interfaceImmutableValue- Specified by:
asMapValuein interfaceValue
-
asExtensionValue
public ImmutableExtensionValue asExtensionValue()
Description copied from interface:ValueReturns the value asExtensionValue. Otherwise throwsMessageTypeCastException. Note that you can't useinstanceofor cast((ExtensionValue) thisValue)to check type of a value because type of a mutable value is variable.- Specified by:
asExtensionValuein interfaceValue
-
-