public final class JsonLong extends Object implements JsonNumber
long, which is the same as Embulk's LONG column type.JsonValue.EntityType| Modifier and Type | Method and Description |
|---|---|
JsonLong |
asJsonLong()
Returns this value as
JsonLong. |
BigDecimal |
bigDecimalValue()
Returns this JSON integral number as a
BigDecimal. |
BigInteger |
bigIntegerValue()
Returns this JSON integral number as a
BigInteger. |
BigInteger |
bigIntegerValueExact()
Returns this JSON integral number as a
BigInteger. |
byte |
byteValue()
Returns this JSON integral number as a Java primitive
byte. |
byte |
byteValueExact()
Returns this JSON integral number as a Java primitive
byte. |
double |
doubleValue()
Returns this JSON integral number as a Java primitive
double. |
boolean |
equals(Object otherObject)
Compares the specified object with this JSON integral number for equality.
|
float |
floatValue()
Returns this JSON integral number as a Java primitive
float. |
JsonValue.EntityType |
getEntityType()
Returns
JsonValue.EntityType.LONG, which is the entity type of JsonLong. |
int |
hashCode()
Returns the hash code value for this JSON integral number.
|
int |
intValue()
Returns this JSON integral number as a Java primitive
int. |
int |
intValueExact()
Returns this JSON integral number as a Java primitive
int. |
boolean |
isByteValue()
Returns
true if the JSON integral number is in the range of byte, [-27 to 27-1]. |
boolean |
isIntegral()
Returns
true to represent this JSON number is integral. |
boolean |
isIntValue()
Returns
true if the JSON integral number is in the range of int, [-231 to 231-1]. |
boolean |
isLongValue()
Returns
true. |
boolean |
isShortValue()
Returns
true if the JSON integral number is in the range of short, [-215 to 215-1]. |
long |
longValue()
Returns this JSON integral number as a Java primitive
long. |
long |
longValueExact()
Returns this JSON integral number as a Java primitive
long. |
static JsonLong |
of(long value)
Returns a JSON integral number represented by the specified Java primitive
long. |
int |
presumeReferenceSizeInBytes()
|
short |
shortValue()
Returns this JSON integral number as a Java primitive
short. |
short |
shortValueExact()
Returns this JSON integral number as a Java primitive
short. |
String |
toJson()
Returns the stringified JSON representation of this JSON integral 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 integral number.
|
static JsonLong |
withLiteral(long value,
String literal)
Returns a JSON integral number represented by the specified Java primitive
long, with the specified JSON literal. |
clone, finalize, getClass, notify, notifyAll, wait, wait, waitasJsonArray, asJsonBoolean, asJsonDouble, asJsonNull, asJsonObject, asJsonString, fromMsgpack, isJsonArray, isJsonBoolean, isJsonDouble, isJsonLong, isJsonNull, isJsonObject, isJsonStringpublic static JsonLong of(long value)
long.value - the integral numberlongpublic static JsonLong withLiteral(long value, String literal)
long, with the specified JSON literal.
The literal is just subsidiary information used when stringifying this integral number as JSON by toJson().
The literal does not impact the equality definition by equals(Object).
value - the integral numberliteral - the JSON literal of the integral numberlongpublic JsonValue.EntityType getEntityType()
JsonValue.EntityType.LONG, which is the entity type of JsonLong.getEntityType in interface JsonValueJsonValue.EntityType.LONG, which is the entity type of JsonLongpublic JsonLong asJsonLong()
JsonLong.asJsonLong in interface JsonValueJsonLongpublic int presumeReferenceSizeInBytes()
8 for the size of long 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 to represent this JSON number is integral.isIntegral in interface JsonNumbertruepublic boolean isByteValue()
true if the JSON integral number is in the range of byte, [-27 to 27-1].isByteValue in interface JsonNumbertrue if the JSON integral number is in the range of bytepublic boolean isShortValue()
true if the JSON integral number is in the range of short, [-215 to 215-1].isShortValue in interface JsonNumbertrue if the JSON integral number is in the range of shortpublic boolean isIntValue()
true if the JSON integral number is in the range of int, [-231 to 231-1].isIntValue in interface JsonNumbertrue if the JSON integral number is in the range of intpublic boolean isLongValue()
true.isLongValue in interface JsonNumbertrue, alwayspublic byte byteValue()
byte.
It narrows down long to byte as a Java primitive. Note that this conversion can lose information
about the magnitude of this JSON integral number, and can cause the sign of the resulting value to differ from the sign
of this JSON integral number.
byteValue in interface JsonNumberbyte representation of this JSON integral numberpublic byte byteValueExact()
byte.
It throws ArithmeticException if the JSON integral number is out of the range of byte.
byteValueExact in interface JsonNumberbyte representation of this JSON integral numberArithmeticException - if the JSON integral number does not fit in a Java primitive bytepublic short shortValue()
short.
It narrows down long to short as a Java primitive. Note that this conversion can lose information
about the magnitude of this JSON integral number, and can cause the sign of the resulting value to differ from the sign
of this JSON integral number.
shortValue in interface JsonNumbershort representation of this JSON integral numberpublic short shortValueExact()
short.
It throws ArithmeticException if the JSON integral number is out of the range of short.
shortValueExact in interface JsonNumbershort representation of this JSON integral numberArithmeticException - if the JSON integral number does not fit in a Java primitive shortpublic int intValue()
int.
It narrows down long to int as a Java primitive. Note that this conversion can lose information
about the magnitude of this JSON integral number, and can cause the sign of the resulting value to differ from the sign
of this JSON integral number.
intValue in interface JsonNumberint representation of this JSON integral numberpublic int intValueExact()
int.
It throws ArithmeticException if the JSON integral number is out of the range of int.
intValueExact in interface JsonNumberint representation of this JSON integral numberArithmeticException - if the JSON integral number does not fit in a Java primitive intpublic long longValue()
long.longValue in interface JsonNumberlong representation of this JSON integral numberpublic long longValueExact()
long.longValueExact in interface JsonNumberlong representation of this JSON integral numberpublic BigInteger bigIntegerValue()
BigInteger.bigIntegerValue in interface JsonNumberBigInteger representation of this JSON integral numberpublic BigInteger bigIntegerValueExact()
BigInteger.bigIntegerValueExact in interface JsonNumberBigInteger representation of this JSON integral numberpublic float floatValue()
float.
It widens long to float as a Java primitive. Note that this conversion can lose precision of
this JSON integral number.
floatValue in interface JsonNumberfloat representation of this JSON integral numberpublic double doubleValue()
double.
It widens long to double as a Java primitive. Note that this conversion can lose precision of
this JSON integral number.
doubleValue in interface JsonNumberdouble representation of this JSON integral numberpublic BigDecimal bigDecimalValue()
BigDecimal.bigDecimalValue in interface JsonNumberBigDecimal representation of this JSON integral numberpublic String toJson()
If this JSON integral number is created with a literal by withLiteral(long, String), it returns the literal.
@Deprecated public Value toMsgpack()
JsonValue.toMsgpack in interface JsonValuepublic String toString()
public boolean equals(Object otherObject)