public interface JsonNumber extends JsonValue
JsonValue.EntityType| Modifier and Type | Method and Description |
|---|---|
BigDecimal |
bigDecimalValue()
Returns this JSON number as a
BigDecimal. |
BigInteger |
bigIntegerValue()
Returns this JSON number as a
BigInteger. |
BigInteger |
bigIntegerValueExact()
Returns this JSON number as a
BigInteger. |
byte |
byteValue()
Returns this JSON number as a Java primitive
byte. |
byte |
byteValueExact()
Returns this JSON number as a Java primitive
byte. |
double |
doubleValue()
Returns this JSON number as a Java primitive
double. |
float |
floatValue()
Returns this JSON number as a Java primitive
float. |
int |
intValue()
Returns this JSON number as a Java primitive
int. |
int |
intValueExact()
Returns this JSON number as a Java primitive
int. |
boolean |
isByteValue()
Returns
true if the JSON number is integral in the range of byte, [-27 to 27-1]. |
boolean |
isIntegral()
Returns
true if this JSON number is integral. |
boolean |
isIntValue()
Returns
true if the JSON number is integral in the range of int, [-231 to 231-1]. |
boolean |
isLongValue()
Returns
true if the JSON number is integral in the range of long, [-263 to 263-1]. |
boolean |
isShortValue()
Returns
true if the JSON number is integral in the range of short, [-215 to 215-1]. |
long |
longValue()
Returns this JSON number as a Java primitive
long. |
long |
longValueExact()
Returns this JSON number as a Java primitive
long. |
short |
shortValue()
Returns this JSON number as a Java primitive
short. |
short |
shortValueExact()
Returns this JSON number as a Java primitive
short. |
asJsonArray, asJsonBoolean, asJsonDouble, asJsonLong, asJsonNull, asJsonObject, asJsonString, fromMsgpack, getEntityType, isJsonArray, isJsonBoolean, isJsonDouble, isJsonLong, isJsonNull, isJsonObject, isJsonString, presumeReferenceSizeInBytes, toJson, toMsgpackboolean isIntegral()
true if this JSON number is integral.true if this JSON number is integralboolean isByteValue()
true if the JSON number is integral in the range of byte, [-27 to 27-1].true if the JSON number is integral in the range of byteboolean isShortValue()
true if the JSON number is integral in the range of short, [-215 to 215-1].true if the JSON number is integral in the range of shortboolean isIntValue()
true if the JSON number is integral in the range of int, [-231 to 231-1].true if the JSON number is integral in the range of intboolean isLongValue()
true if the JSON number is integral in the range of long, [-263 to 263-1].true if the JSON number is integral in the range of longbyte byteValue()
byte.
It may narrow down the number to byte as a Java primitive. Note that this conversion can lose information
about the magnitude of this JSON number, precision, and range.
byte representation of this JSON numberbyte byteValueExact()
byte.
It throws ArithmeticException if the JSON number is out of the range of byte, or has a
non-zero fractional part.
byte representation of this JSON numberArithmeticException - if the JSON number is out of the range of byte, or has a non-zero fractional partshort shortValue()
short.
It may narrow down the number to short as a Java primitive. Note that this conversion can lose information
about the magnitude of this JSON number, precision, and range.
short representation of this JSON numbershort shortValueExact()
short.
It throws ArithmeticException if the JSON number is out of the range of short, or has a
non-zero fractional part.
short representation of this JSON numberArithmeticException - if the JSON number is out of the range of short, or has a non-zero fractional partint intValue()
int.
It may narrow down the number to int as a Java primitive. Note that this conversion can lose information
about the magnitude of this JSON number, precision, and range.
int representation of this JSON numberint intValueExact()
int.
It throws ArithmeticException if the JSON number is out of the range of int, or has a
non-zero fractional part.
int representation of this JSON numberArithmeticException - if the JSON number is out of the range of int, or has a non-zero fractional partlong longValue()
long.
It may narrow down the number to long as a Java primitive. Note that this conversion can lose information
about the magnitude of this JSON number, precision, and range.
long representation of this JSON numberlong longValueExact()
long.
It throws ArithmeticException if the JSON number is out of the range of long, or has a
non-zero fractional part.
long representation of this JSON numberArithmeticException - if the JSON number is out of the range of long, or has a non-zero fractional partBigInteger bigIntegerValue()
BigInteger.
Note that this conversion loses the fractional part and the precision of the number.
BigInteger representation of this JSON numberBigInteger bigIntegerValueExact()
BigInteger.
It throws ArithmeticException if the JSON number has a non-zero fractional part.
BigInteger representation of this JSON numberArithmeticException - if the JSON number has a non-zero fractional partfloat floatValue()
float.
It may narrow down the number to float as a Java primitive. Note that this conversion can lose information
about the magnitude and the precision of the number.
float representation of this JSON numberdouble doubleValue()
double.
It may narrow down the number to double as a Java primitive. Note that this conversion can lose information
about the magnitude and the precision of the number.
double representation of this JSON numberBigDecimal bigDecimalValue()
BigDecimal.BigDecimal representation of this JSON number