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.BigInteger
asBigInteger()
Returns the value as aBigInteger
.byte
asByte()
Returns the value as abyte
, otherwise throws an exception.int
asInt()
Returns the value as anint
, otherwise throws an exception.long
asLong()
Returns the value as along
, otherwise throws an exception.short
asShort()
Returns the value as ashort
, otherwise throws an exception.boolean
isInByteRange()
Returns true if the value is in the range of [-27 to 27-1].boolean
isInIntRange()
Returns true if the value is in the range of [-231 to 231-1]boolean
isInLongRange()
Returns true if the value is in the range of [-263 to 263-1]boolean
isInShortRange()
Returns true if the value is in the range of [-215 to 215-1]MessageFormat
mostSuccinctMessageFormat()
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 ofbyte
type.
-
asShort
short asShort()
Returns the value as ashort
, otherwise throws an exception.- Throws:
MessageIntegerOverflowException
- If the value does not fit in the range ofshort
type.
-
asInt
int asInt()
Returns the value as anint
, otherwise throws an exception.- Throws:
MessageIntegerOverflowException
- If the value does not fit in the range ofint
type.
-
asLong
long asLong()
Returns the value as along
, otherwise throws an exception.- Throws:
MessageIntegerOverflowException
- If the value does not fit in the range oflong
type.
-
asBigInteger
java.math.BigInteger asBigInteger()
Returns the value as aBigInteger
.
-
-