org.msgpack.value
Interface NumberValue

All Superinterfaces:
Value, ValueRef
All Known Subinterfaces:
FloatValue, IntegerValue
All Known Implementing Classes:
BigIntegerValueImpl, DoubleValueImpl, FloatHolder, FloatValueImpl, IntegerHolder, IntegerValueImpl, LongValueImpl

public interface NumberValue
extends Value

Created on 5/30/14.


Method Summary
 java.math.BigInteger asBigInteger()
          Convert this value into a BigInteger value.
 byte asByte()
          Convert this value into a byte value.
 int asInt()
          Convert this value into an int value.
 long asLong()
          Convert this value into a long value.
 short asShort()
          Convert this value into a short value.
 boolean isValidByte()
          Check whether this value is a valid byte value.
 boolean isValidInt()
          Check whether this value is a valid integer value.
 boolean isValidLong()
          Check whether this value is a valid long value.
 boolean isValidShort()
          Check whether this value is a valid short value.
 boolean isWhole()
          Returns true if this number has no decimal component
 java.math.BigInteger toBigInteger()
          Convert this value into a BigInteger
 byte toByte()
          Convert this value into a byte value.
 double toDouble()
          Convert this value into a double value
 float toFloat()
          Convert this value into a float value
 int toInt()
          Convert this value into an int value.
 long toLong()
          Convert this value into a long value.
 short toShort()
          Convert this value into a short value.
 
Methods inherited from interface org.msgpack.value.Value
asArrayValue, asMapValue
 
Methods inherited from interface org.msgpack.value.ValueRef
accept, asBinary, asBoolean, asExtended, asFloat, asInteger, asNil, asNumber, asRaw, asString, getArrayCursor, getMapCursor, getValueType, isArray, isBinary, isBoolean, isExtended, isFloat, isInteger, isMap, isNil, isNumber, isRaw, isRef, isString, toValue, writeTo
 

Method Detail

isValidByte

boolean isValidByte()
Check whether this value is a valid byte value.

Returns:
true if this value has no fractional part, and is within the range of Byte.MIN_VALUE and Byte.MAX_VALUE; otherwise returns false

isValidShort

boolean isValidShort()
Check whether this value is a valid short value.

Returns:
true if this value has no fractional part, and is within the range of Short.MIN_VALUE and Short.MAX_VALUE; otherwise returns false

isValidInt

boolean isValidInt()
Check whether this value is a valid integer value.

Returns:
true if this value has no fractional part, and is within the range of Integer.MIN_VALUE and Integer.MAX_VALUE; otherwise returns false

isValidLong

boolean isValidLong()
Check whether this value is a valid long value.

Returns:
true if this value has no fractional part, and is within the range of Long.MIN_VALUE and Long.MAX_VALUE; otherwise returns false

isWhole

boolean isWhole()
Returns true if this number has no decimal component

Returns:
true if this number has no decimal component, otherwise false (float, double values);

toByte

byte toByte()
Convert this value into a byte value. If this value is not within the range of Byte value, it will truncate or round the value.


toShort

short toShort()
Convert this value into a short value. If this value is not within the range of Short value, it will truncate or round the value.


toInt

int toInt()
Convert this value into an int value. If this value is not within the range of Int value, it will truncate or round the value.


toLong

long toLong()
Convert this value into a long value. If this value is not within the range of Long value, it will truncate or round the value.


toBigInteger

java.math.BigInteger toBigInteger()
Convert this value into a BigInteger


toFloat

float toFloat()
Convert this value into a float value


toDouble

double toDouble()
Convert this value into a double value


asByte

byte asByte()
            throws MessageOverflowException
Convert this value into a byte value. If this value is not within the range of Byte value, it throws an exception.

Returns:
Throws:
MessageOverflowException - when the value is not within the range of Byte.MIN_VALUE and Byte.MAX_VALUE;

asShort

short asShort()
              throws MessageOverflowException
Convert this value into a short value. If this value is not within the range of Short value, it throws an exception.

Returns:
Throws:
MessageOverflowException - when the value is not within the range of Short.MIN_VALUE and Short.MAX_VALUE

asInt

int asInt()
          throws MessageOverflowException
Convert this value into an int value. If this value is not within the range of Integer value, it throws an exception.

Returns:
Throws:
MessageOverflowException - when the value is not within the range of Integer.MIN_VALUE and Integer.MAX_VALUE

asLong

long asLong()
            throws MessageOverflowException
Convert this value into a long value. If this value is not within the range of Long value, it throws an exception.

Returns:
Throws:
MessageOverflowException - when the value is not within the range of Long.MIN_VALUE and Long.MAX_VALUE

asBigInteger

java.math.BigInteger asBigInteger()
                                  throws MessageOverflowException
Convert this value into a BigInteger value.

Returns:
Throws:
MessageOverflowException