public class ImmutableLongValueImpl extends AbstractImmutableValue implements ImmutableIntegerValue
ImmutableLongValueImpl Implements ImmutableIntegerValue using a long field.IntegerValue| Modifier and Type | Field and Description |
|---|---|
private static long |
BYTE_MAX |
private static long |
BYTE_MIN |
private static long |
INT_MAX |
private static long |
INT_MIN |
private static long |
SHORT_MAX |
private static long |
SHORT_MIN |
private long |
value |
| Constructor and Description |
|---|
ImmutableLongValueImpl(long value) |
| Modifier and Type | Method and Description |
|---|---|
java.math.BigInteger |
asBigInteger()
Returns the value as a
BigInteger. |
byte |
asByte()
Returns the value as a
byte, otherwise throws an exception. |
int |
asInt()
Returns the value as an
int, otherwise throws an exception. |
ImmutableIntegerValue |
asIntegerValue()
Returns the value as
IntegerValue. |
long |
asLong()
Returns the value as a
long, otherwise throws an exception. |
ImmutableNumberValue |
asNumberValue()
Returns the value as
NumberValue. |
short |
asShort()
Returns the value as a
short, otherwise throws an exception. |
boolean |
equals(java.lang.Object o)
Compares this value to the specified object.
|
ValueType |
getValueType()
Returns type of this value.
|
int |
hashCode() |
ImmutableIntegerValue |
immutableValue()
Returns immutable copy of this value.
|
boolean |
isInByteRange()
Returns true if the value is in the range of [-27 to 27-1].
|
boolean |
isInIntRange()
Returns true if the value is in the range of [-231 to 231-1]
|
boolean |
isInLongRange()
Returns true if the value is in the range of [-263 to 263-1]
|
boolean |
isInShortRange()
Returns true if the value is in the range of [-215 to 215-1]
|
MessageFormat |
mostSuccinctMessageFormat()
Returns the most succinct MessageFormat type to represent this integer value.
|
java.math.BigInteger |
toBigInteger()
Represent this value as a BigInteger, which may involve rounding or truncation of the original value.
|
byte |
toByte()
Represent this value as a byte value, which may involve rounding or truncation of the original value.
|
double |
toDouble()
Represent this value as a 64-bit double value, which may involve rounding or truncation of the original value.
|
float |
toFloat()
Represent this value as a 32-bit float value, which may involve rounding or truncation of the original value.
|
int |
toInt()
Represent this value as an int value, which may involve rounding or truncation of the original value.
|
java.lang.String |
toJson()
Returns json representation of this Value.
|
long |
toLong()
Represent this value as a long value, which may involve rounding or truncation of the original value.
|
short |
toShort()
Represent this value as a short value, which may involve rounding or truncation of the original value.
|
java.lang.String |
toString() |
void |
writeTo(MessagePacker pk)
Serializes the value using the specified
MessagePacker |
asArrayValue, asBinaryValue, asBooleanValue, asExtensionValue, asFloatValue, asMapValue, asNilValue, asRawValue, asStringValue, asTimestampValue, isArrayValue, isBinaryValue, isBooleanValue, isExtensionValue, isFloatValue, isIntegerValue, isMapValue, isNilValue, isNumberValue, isRawValue, isStringValue, isTimestampValueclone, finalize, getClass, notify, notifyAll, wait, wait, waitasArrayValue, asBinaryValue, asBooleanValue, asFloatValue, asMapValue, asNilValue, asRawValue, asStringValue, asTimestampValueasExtensionValue, isArrayValue, isBinaryValue, isBooleanValue, isExtensionValue, isFloatValue, isIntegerValue, isMapValue, isNilValue, isNumberValue, isRawValue, isStringValue, isTimestampValueprivate final long value
private static final long BYTE_MIN
private static final long BYTE_MAX
private static final long SHORT_MIN
private static final long SHORT_MAX
private static final long INT_MIN
private static final long INT_MAX
public ValueType getValueType()
Valueinstanceof to check type of a value because type of a mutable value is variable.getValueType in interface Valuepublic ImmutableIntegerValue immutableValue()
Valuethis without copying the value if this value is already immutable.immutableValue in interface Valuepublic ImmutableNumberValue asNumberValue()
ValueNumberValue. Otherwise throws MessageTypeCastException.
Note that you can't use instanceof or cast ((NumberValue) thisValue) to check type of a value because type of a mutable value is variable.asNumberValue in interface ValueasNumberValue in class AbstractImmutableValuepublic ImmutableIntegerValue asIntegerValue()
ValueIntegerValue. Otherwise throws MessageTypeCastException.
Note that you can't use instanceof or cast ((IntegerValue) thisValue) to check type of a value because type of a mutable value is variable.asIntegerValue in interface ImmutableValueasIntegerValue in interface ValueasIntegerValue in class AbstractImmutableValuepublic byte toByte()
NumberValuetoByte in interface NumberValuepublic short toShort()
NumberValuetoShort in interface NumberValuepublic int toInt()
NumberValuetoInt in interface NumberValuepublic long toLong()
NumberValuetoLong in interface NumberValuepublic java.math.BigInteger toBigInteger()
NumberValuetoBigInteger in interface NumberValuepublic float toFloat()
NumberValuetoFloat in interface NumberValuepublic double toDouble()
NumberValuetoDouble in interface NumberValuepublic boolean isInByteRange()
IntegerValueisInByteRange in interface IntegerValuepublic boolean isInShortRange()
IntegerValueisInShortRange in interface IntegerValuepublic boolean isInIntRange()
IntegerValueisInIntRange in interface IntegerValuepublic boolean isInLongRange()
IntegerValueisInLongRange in interface IntegerValuepublic MessageFormat mostSuccinctMessageFormat()
IntegerValuemostSuccinctMessageFormat in interface IntegerValuepublic byte asByte()
IntegerValuebyte, otherwise throws an exception.asByte in interface IntegerValuepublic short asShort()
IntegerValueshort, otherwise throws an exception.asShort in interface IntegerValuepublic int asInt()
IntegerValueint, otherwise throws an exception.asInt in interface IntegerValuepublic long asLong()
IntegerValuelong, otherwise throws an exception.asLong in interface IntegerValuepublic java.math.BigInteger asBigInteger()
IntegerValueBigInteger.asBigInteger in interface IntegerValuepublic void writeTo(MessagePacker pk) throws java.io.IOException
ValueMessagePackerwriteTo in interface Valuejava.io.IOExceptionMessagePackerpublic boolean equals(java.lang.Object o)
Valuetrue if type and value are equivalent.
If this value is MapValue or ArrayValue, this method check equivalence of elements recursively.public int hashCode()
hashCode in class java.lang.Objectpublic java.lang.String toJson()
ValueFollowing behavior is not configurable at this release and they might be changed at future releases:
U+FFFD replacement character.U+FFFD replacement characterpublic java.lang.String toString()
toString in class java.lang.Object