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, wait
asJsonArray, asJsonBoolean, asJsonDouble, asJsonNull, asJsonObject, asJsonString, fromMsgpack, isJsonArray, isJsonBoolean, isJsonDouble, isJsonLong, isJsonNull, isJsonObject, isJsonString
public static JsonLong of(long value)
long
.value
- the integral numberlong
public 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 numberlong
public JsonValue.EntityType getEntityType()
JsonValue.EntityType.LONG
, which is the entity type of JsonLong
.getEntityType
in interface JsonValue
JsonValue.EntityType.LONG
, which is the entity type of JsonLong
public JsonLong asJsonLong()
JsonLong
.asJsonLong
in interface JsonValue
JsonLong
public 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 JsonValue
8
public boolean isIntegral()
true
to represent this JSON number is integral.isIntegral
in interface JsonNumber
true
public boolean isByteValue()
true
if the JSON integral number is in the range of byte
, [-27 to 27-1].isByteValue
in interface JsonNumber
true
if the JSON integral number is in the range of byte
public boolean isShortValue()
true
if the JSON integral number is in the range of short
, [-215 to 215-1].isShortValue
in interface JsonNumber
true
if the JSON integral number is in the range of short
public boolean isIntValue()
true
if the JSON integral number is in the range of int
, [-231 to 231-1].isIntValue
in interface JsonNumber
true
if the JSON integral number is in the range of int
public boolean isLongValue()
true
.isLongValue
in interface JsonNumber
true
, 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 JsonNumber
byte
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 JsonNumber
byte
representation of this JSON integral numberArithmeticException
- if the JSON integral number does not fit in a Java primitive byte
public 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 JsonNumber
short
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 JsonNumber
short
representation of this JSON integral numberArithmeticException
- if the JSON integral number does not fit in a Java primitive short
public 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 JsonNumber
int
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 JsonNumber
int
representation of this JSON integral numberArithmeticException
- if the JSON integral number does not fit in a Java primitive int
public long longValue()
long
.longValue
in interface JsonNumber
long
representation of this JSON integral numberpublic long longValueExact()
long
.longValueExact
in interface JsonNumber
long
representation of this JSON integral numberpublic BigInteger bigIntegerValue()
BigInteger
.bigIntegerValue
in interface JsonNumber
BigInteger
representation of this JSON integral numberpublic BigInteger bigIntegerValueExact()
BigInteger
.bigIntegerValueExact
in interface JsonNumber
BigInteger
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 JsonNumber
float
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 JsonNumber
double
representation of this JSON integral numberpublic BigDecimal bigDecimalValue()
BigDecimal
.bigDecimalValue
in interface JsonNumber
BigDecimal
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 JsonValue
public String toString()
public boolean equals(Object otherObject)