public final class JsonDouble extends Object implements JsonNumber
double, which is the same as Embulk's DOUBLE column type.
It does not accept NaN (Not-a-Number) and the infinity.
JsonValue.EntityType| Modifier and Type | Method and Description |
|---|---|
JsonDouble |
asJsonDouble()
Returns this value as
JsonDouble. |
BigDecimal |
bigDecimalValue()
Returns this JSON number as
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, as-is. |
boolean |
equals(Object otherObject)
Compares the specified object with this JSON number for equality.
|
float |
floatValue()
Returns this JSON number as a Java primitive
float. |
JsonValue.EntityType |
getEntityType()
Returns
JsonValue.EntityType.DOUBLE, which is the entity type of JsonDouble. |
int |
hashCode()
Returns the hash code value for this JSON number.
|
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. |
static JsonDouble |
of(double value)
Returns a JSON number represented by the specified Java primitive
double. |
int |
presumeReferenceSizeInBytes()
|
short |
shortValue()
Returns this JSON number as a Java primitive
short. |
short |
shortValueExact()
Returns this JSON number as a Java primitive
short. |
String |
toJson()
Returns the stringified JSON representation of this JSON number.
|
Value |
toMsgpack()
Deprecated.
Do not use this method. It is to be removed at some point after Embulk v1.0.0.
It is here only to ensure a migration period from MessagePack-based JSON values to new
JSON values of
JsonValue. |
String |
toString()
Returns the string representation of this JSON number.
|
static JsonDouble |
withLiteral(double value,
String literal)
Returns a JSON number that is represented by the specified Java primitive
double, with the specified JSON literal. |
clone, finalize, getClass, notify, notifyAll, wait, wait, waitasJsonArray, asJsonBoolean, asJsonLong, asJsonNull, asJsonObject, asJsonString, fromMsgpack, isJsonArray, isJsonBoolean, isJsonDouble, isJsonLong, isJsonNull, isJsonObject, isJsonStringpublic static JsonDouble of(double value)
double.value - the numberdoubleArithmeticException - if the specified number is NaN (Not-a-Number) or infinitepublic static JsonDouble withLiteral(double value, String literal)
double, with the specified JSON literal.
The literal is just subsidiary information used when stringifying this JSON number as JSON by toJson().
value - the numberliteral - the JSON literal of the numberdoubleArithmeticException - if the specified number is NaN (Not-a-Number) or infinitepublic JsonValue.EntityType getEntityType()
JsonValue.EntityType.DOUBLE, which is the entity type of JsonDouble.getEntityType in interface JsonValueJsonValue.EntityType.DOUBLE, which is the entity type of JsonDoublepublic JsonDouble asJsonDouble()
JsonDouble.asJsonDouble in interface JsonValueJsonDoublepublic int presumeReferenceSizeInBytes()
8 for the size of double in bytes presumed to occupy in Page as a reference.
This approximate size is used only as a threshold whether PageBuilder is flushed, or not.
It is not accurate, it does not need to be accurate, and it is impossible in general to tell an accurate size that
a Java object occupies in the Java heap. But, a reasonable approximate would help to keep Page
performant in the Java heap.
It is better to flush more frequently for bigger JSON value objects, less often for smaller JSON value objects, but no infinite accumulation even for empty JSON value objects.
presumeReferenceSizeInBytes in interface JsonValue8public boolean isIntegral()
true if this JSON number is integral.
Note that it does not guarantee this JSON number can be represented as a Java primitive exact long.
This JSON number can be out of the range of the Java primitive long.
isIntegral in interface JsonNumbertrue if this JSON number is integralpublic boolean isByteValue()
true if the JSON number is integral in the range of byte, [-27 to 27-1].isByteValue in interface JsonNumbertrue if the JSON number is integral in the range of bytepublic boolean isShortValue()
true if the JSON number is integral in the range of short, [-215 to 215-1].isShortValue in interface JsonNumbertrue if the JSON number is integral in the range of shortpublic boolean isIntValue()
true if the JSON number is integral in the range of int, [-231 to 231-1].isIntValue in interface JsonNumbertrue if the JSON number is integral in the range of intpublic boolean isLongValue()
true if the JSON number is integral in the range of long, [-263 to 263-1].isLongValue in interface JsonNumbertrue if the JSON number is integral in the range of longpublic byte byteValue()
byte.
It narrows down double to byte as a Java primitive. Note that this conversion can lose information
about the magnitude of this JSON number, precision, and range.
byteValue in interface JsonNumberbyte representation of this JSON numberpublic byte byteValueExact()
byte.
It throws ArithmeticException if the JSON number is out of the range of byte, or has a
non-zero fractional part.
byteValueExact in interface JsonNumberbyte representation of this JSON numberArithmeticException - if the JSON number is out of the range of byte, or has a non-zero fractional partpublic short shortValue()
short.
It narrows down double to short as a Java primitive. Note that this conversion can lose information
about the magnitude of this JSON number, precision, and range.
shortValue in interface JsonNumbershort representation of this JSON numberpublic short shortValueExact()
short.
It throws ArithmeticException if the JSON number is out of the range of short, or has a
non-zero fractional part.
shortValueExact in interface JsonNumbershort representation of this JSON numberArithmeticException - if the JSON number is out of the range of short, or has a non-zero fractional partpublic int intValue()
int.
It narrows down double to int as a Java primitive. Note that this conversion can lose information
about the magnitude of this JSON number, precision, and range.
intValue in interface JsonNumberint representation of this JSON numberpublic int intValueExact()
int.
It throws ArithmeticException if the JSON number is out of the range of int, or has a
non-zero fractional part.
intValueExact in interface JsonNumberint representation of this JSON numberArithmeticException - if the JSON number is out of the range of int, or has a non-zero fractional partpublic long longValue()
long.
It narrows down double to long as a Java primitive. Note that this conversion can lose information
about the magnitude of this JSON number, precision, and range.
longValue in interface JsonNumberlong representation of this JSON numberpublic long longValueExact()
long.
It throws ArithmeticException if the JSON number is out of the range of long, or has a
non-zero fractional part.
longValueExact in interface JsonNumberlong representation of this JSON numberArithmeticException - if the JSON number is out of the range of long, or has a non-zero fractional partpublic BigInteger bigIntegerValue()
BigInteger.
Note that this conversion loses the fractional part and the precision of the number.
This is a convenience method for bigDecimalValue().toBigInteger().
bigIntegerValue in interface JsonNumberBigInteger representation of this JSON numberpublic BigInteger bigIntegerValueExact()
BigInteger.
It throws ArithmeticException if the JSON number has a non-zero fractional part.
bigIntegerValueExact in interface JsonNumberBigInteger representation of this JSON numberArithmeticException - if the JSON number has a non-zero fractional partpublic float floatValue()
float.
It narrows down double to float as a Java primitive. Note that this conversion can lose information
about the magnitude and the precision of the number.
floatValue in interface JsonNumberfloat representation of this JSON numberpublic double doubleValue()
double, as-is.
This method does not lose any information because JsonDouble represents the number as a Java primitive
double inside.
doubleValue in interface JsonNumberdouble representation of this JSON numberpublic BigDecimal bigDecimalValue()
BigDecimal.bigDecimalValue in interface JsonNumberBigDecimal representation of this JSON numberpublic String toJson()
If this JSON number is created with a literal by withLiteral(double, String), it returns the literal.
@Deprecated public Value toMsgpack()
JsonValue.toMsgpack in interface JsonValuepublic String toString()
public boolean equals(Object otherObject)