Package org.msgpack.value
Interface IntegerValue
-
- All Superinterfaces:
NumberValue,Value
- All Known Subinterfaces:
ImmutableIntegerValue
- All Known Implementing Classes:
ImmutableBigIntegerValueImpl,ImmutableLongValueImpl
public interface IntegerValue extends NumberValue
Representation of MessagePack's Integer type. MessagePack's Integer type can represent from -263 to 264-1.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.math.BigIntegerasBigInteger()Returns the value as aBigInteger.byteasByte()Returns the value as abyte, otherwise throws an exception.intasInt()Returns the value as anint, otherwise throws an exception.longasLong()Returns the value as along, otherwise throws an exception.shortasShort()Returns the value as ashort, otherwise throws an exception.booleanisInByteRange()Returns true if the value is in the range of [-27 to 27-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]booleanisInShortRange()Returns true if the value is in the range of [-215 to 215-1]MessageFormatmostSuccinctMessageFormat()Returns the most succinct MessageFormat type to represent this integer value.-
Methods inherited from interface org.msgpack.value.NumberValue
toBigInteger, toByte, toDouble, toFloat, toInt, toLong, toShort
-
Methods inherited from interface org.msgpack.value.Value
asArrayValue, asBinaryValue, asBooleanValue, asExtensionValue, asFloatValue, asIntegerValue, asMapValue, asNilValue, asNumberValue, asRawValue, asStringValue, equals, getValueType, immutableValue, isArrayValue, isBinaryValue, isBooleanValue, isExtensionValue, isFloatValue, isIntegerValue, isMapValue, isNilValue, isNumberValue, isRawValue, isStringValue, toJson, writeTo
-
-
-
-
Method Detail
-
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.- Returns:
- the smallest integer type of MessageFormat that is big enough to store the value.
-
asByte
byte asByte()
Returns the value as abyte, otherwise throws an exception.- Throws:
MessageIntegerOverflowException- If the value does not fit in the range ofbytetype.
-
asShort
short asShort()
Returns the value as ashort, otherwise throws an exception.- Throws:
MessageIntegerOverflowException- If the value does not fit in the range ofshorttype.
-
asInt
int asInt()
Returns the value as anint, otherwise throws an exception.- Throws:
MessageIntegerOverflowException- If the value does not fit in the range ofinttype.
-
asLong
long asLong()
Returns the value as along, otherwise throws an exception.- Throws:
MessageIntegerOverflowException- If the value does not fit in the range oflongtype.
-
asBigInteger
java.math.BigInteger asBigInteger()
Returns the value as aBigInteger.
-
-