-
- All Implemented Interfaces:
-
com.batch.android.msgpack.value.ImmutableIntegerValue,com.batch.android.msgpack.value.ImmutableNumberValue,com.batch.android.msgpack.value.ImmutableValue,com.batch.android.msgpack.value.IntegerValue,com.batch.android.msgpack.value.NumberValue,com.batch.android.msgpack.value.Value
public class ImmutableBigIntegerValueImpl extends AbstractImmutableValue implements ImmutableIntegerValue
{@code ImmutableBigIntegerValueImpl}Implements{@code ImmutableBigIntegerValue}using a{@code BigInteger}field.
-
-
Constructor Summary
Constructors Constructor Description ImmutableBigIntegerValueImpl(BigInteger value)
-
Method Summary
Modifier and Type Method Description static MessageFormatmostSuccinctMessageFormat(IntegerValue v)ValueTypegetValueType()Returns type of this value. ImmutableIntegerValueimmutableValue()Returns immutable copy of this value. ImmutableNumberValueasNumberValue()Returns the value as {@code NumberValue}.ImmutableIntegerValueasIntegerValue()Returns the value as {@code IntegerValue}.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. booleanisInByteRange()Returns true if the value is in the range of [-27 to 27-1]. booleanisInShortRange()Returns true if the value is in the range of [-215 to 215-1] booleanisInIntRange()Returns true if the value is in the range of [-231 to 231-1] booleanisInLongRange()Returns true if the value is in the range of [-263 to 263-1] MessageFormatmostSuccinctMessageFormat()Returns the most succinct MessageFormat type to represent this integer value. byteasByte()Returns the value as a {@code byte}, otherwise throws an exception.shortasShort()Returns the value as a {@code short}, otherwise throws an exception.intasInt()Returns the value as an {@code int}, otherwise throws an exception.longasLong()Returns the value as a {@code long}, otherwise throws an exception.BigIntegerasBigInteger()Returns the value as a {@code BigInteger}.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, asFloatValue, 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
-
-
Constructor Detail
-
ImmutableBigIntegerValueImpl
ImmutableBigIntegerValueImpl(BigInteger value)
-
-
Method Detail
-
mostSuccinctMessageFormat
static MessageFormat mostSuccinctMessageFormat(IntegerValue v)
-
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
ImmutableIntegerValue 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.
-
asIntegerValue
ImmutableIntegerValue 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.
-
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.
-
isInByteRange
boolean isInByteRange()
Returns true if the value is in the range of [-27 to 27-1].
-
isInShortRange
boolean isInShortRange()
Returns true if the value is in the range of [-215 to 215-1]
-
isInIntRange
boolean isInIntRange()
Returns true if the value is in the range of [-231 to 231-1]
-
isInLongRange
boolean isInLongRange()
Returns true if the value is in the range of [-263 to 263-1]
-
mostSuccinctMessageFormat
MessageFormat mostSuccinctMessageFormat()
Returns the most succinct MessageFormat type to represent this integer value.
-
asByte
byte asByte()
Returns the value as a
{@code byte}, otherwise throws an exception.
-
asShort
short asShort()
Returns the value as a
{@code short}, otherwise throws an exception.
-
asInt
int asInt()
Returns the value as an
{@code int}, otherwise throws an exception.
-
asLong
long asLong()
Returns the value as a
{@code long}, otherwise throws an exception.
-
asBigInteger
BigInteger asBigInteger()
Returns the value as a
{@code BigInteger}.
-
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
-
-
-
-