public class ImmutableBigIntegerValueImpl extends java.lang.Object implements ImmutableIntegerValue
ImmutableBigIntegerValueImpl
Implements ImmutableBigIntegerValue
using a BigInteger
field.IntegerValue
Constructor and Description |
---|
ImmutableBigIntegerValueImpl(java.math.BigInteger value) |
Modifier and Type | Method and Description |
---|---|
ImmutableArrayValue |
asArrayValue()
Returns the value as
ArrayValue . |
java.math.BigInteger |
asBigInteger()
Returns the value as a
BigInteger . |
ImmutableBinaryValue |
asBinaryValue()
Returns the value as
BinaryValue . |
ImmutableBooleanValue |
asBooleanValue()
Returns the value as
BooleanValue . |
byte |
asByte()
Returns the value as a
byte , otherwise throws an exception. |
ImmutableExtensionValue |
asExtensionValue()
Returns the value as
ExtensionValue . |
ImmutableFloatValue |
asFloatValue()
Returns the value as
FloatValue . |
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. |
ImmutableMapValue |
asMapValue()
Returns the value as
MapValue . |
ImmutableNilValue |
asNilValue()
Returns the value as
NilValue . |
ImmutableNumberValue |
asNumberValue()
Returns the value as
NumberValue . |
ImmutableRawValue |
asRawValue()
Returns the value as
RawValue . |
short |
asShort()
Returns the value as a
short , otherwise throws an exception. |
ImmutableStringValue |
asStringValue()
Returns the value as
StringValue . |
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 |
isArrayValue()
Returns true if type of this value is Array.
|
boolean |
isBinaryValue()
Returns true if type of this value is Binary.
|
boolean |
isBooleanValue()
Returns true if type of this value is Boolean.
|
boolean |
isExtensionValue()
Returns true if type of this an Extension.
|
boolean |
isFloatValue()
Returns true if type of this value is Float.
|
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]
|
boolean |
isIntegerValue()
Returns true if type of this value is Integer.
|
boolean |
isMapValue()
Returns true if type of this value is Map.
|
boolean |
isNilValue()
Returns true if type of this value is Nil.
|
boolean |
isNumberValue()
Returns true if type of this value is Integer or Float.
|
boolean |
isRawValue()
Returns true if type of this value is String or Binary.
|
boolean |
isStringValue()
Returns true if type of this value is String.
|
MessageFormat |
mostSuccinctMessageFormat()
Returns the most succinct MessageFormat type to represent this integer value.
|
static MessageFormat |
mostSuccinctMessageFormat(IntegerValue v) |
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 |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
asArrayValue, asBinaryValue, asBooleanValue, asFloatValue, asMapValue, asNilValue, asRawValue, asStringValue
asExtensionValue, isArrayValue, isBinaryValue, isBooleanValue, isExtensionValue, isFloatValue, isIntegerValue, isMapValue, isNilValue, isNumberValue, isRawValue, isStringValue
public ImmutableBigIntegerValueImpl(java.math.BigInteger value)
public static MessageFormat mostSuccinctMessageFormat(IntegerValue v)
public ValueType getValueType()
Value
instanceof
to check type of a value because type of a mutable value is variable.getValueType
in interface Value
public ImmutableIntegerValue immutableValue()
Value
this
without copying the value if this value is already immutable.immutableValue
in interface Value
public ImmutableNumberValue asNumberValue()
Value
NumberValue
. 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 Value
public ImmutableIntegerValue asIntegerValue()
Value
IntegerValue
. 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 ImmutableValue
asIntegerValue
in interface Value
public byte toByte()
NumberValue
toByte
in interface NumberValue
public short toShort()
NumberValue
toShort
in interface NumberValue
public int toInt()
NumberValue
toInt
in interface NumberValue
public long toLong()
NumberValue
toLong
in interface NumberValue
public java.math.BigInteger toBigInteger()
NumberValue
toBigInteger
in interface NumberValue
public float toFloat()
NumberValue
toFloat
in interface NumberValue
public double toDouble()
NumberValue
toDouble
in interface NumberValue
public boolean isInByteRange()
IntegerValue
isInByteRange
in interface IntegerValue
public boolean isInShortRange()
IntegerValue
isInShortRange
in interface IntegerValue
public boolean isInIntRange()
IntegerValue
isInIntRange
in interface IntegerValue
public boolean isInLongRange()
IntegerValue
isInLongRange
in interface IntegerValue
public MessageFormat mostSuccinctMessageFormat()
IntegerValue
mostSuccinctMessageFormat
in interface IntegerValue
public byte asByte()
IntegerValue
byte
, otherwise throws an exception.asByte
in interface IntegerValue
public short asShort()
IntegerValue
short
, otherwise throws an exception.asShort
in interface IntegerValue
public int asInt()
IntegerValue
int
, otherwise throws an exception.asInt
in interface IntegerValue
public long asLong()
IntegerValue
long
, otherwise throws an exception.asLong
in interface IntegerValue
public java.math.BigInteger asBigInteger()
IntegerValue
BigInteger
.asBigInteger
in interface IntegerValue
public void writeTo(MessagePacker pk) throws java.io.IOException
Value
MessagePacker
writeTo
in interface Value
java.io.IOException
MessagePacker
public boolean equals(java.lang.Object o)
Value
true
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.Object
public java.lang.String toJson()
Value
Following behavior is not configurable at this release and they might be changed at future releases:
U+FFFD replacement character
.U+FFFD replacement character
public java.lang.String toString()
toString
in class java.lang.Object
public boolean isNilValue()
Value
asNilValue
never throws exceptions.
Note that you can't use instanceof
or cast ((NilValue) thisValue)
to check type of a value because type of a mutable value is variable.isNilValue
in interface Value
public boolean isBooleanValue()
Value
asBooleanValue
never throws exceptions.
Note that you can't use instanceof
or cast ((BooleanValue) thisValue)
to check type of a value because type of a mutable value is variable.isBooleanValue
in interface Value
public boolean isNumberValue()
Value
asNumberValue
never throws exceptions.
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.isNumberValue
in interface Value
public boolean isIntegerValue()
Value
asIntegerValue
never throws exceptions.
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.isIntegerValue
in interface Value
public boolean isFloatValue()
Value
asFloatValue
never throws exceptions.
Note that you can't use instanceof
or cast ((FloatValue) thisValue)
to check type of a value because type of a mutable value is variable.isFloatValue
in interface Value
public boolean isRawValue()
Value
asRawValue
never throws exceptions.
Note that you can't use instanceof
or cast ((RawValue) thisValue)
to check type of a value because type of a mutable value is variable.isRawValue
in interface Value
public boolean isBinaryValue()
Value
asBinaryValue
never throws exceptions.
Note that you can't use instanceof
or cast ((BinaryValue) thisValue)
to check type of a value because type of a mutable value is variable.isBinaryValue
in interface Value
public boolean isStringValue()
Value
asStringValue
never throws exceptions.
Note that you can't use instanceof
or cast ((StringValue) thisValue)
to check type of a value because type of a mutable value is variable.isStringValue
in interface Value
public boolean isArrayValue()
Value
asArrayValue
never throws exceptions.
Note that you can't use instanceof
or cast ((ArrayValue) thisValue)
to check type of a value because type of a mutable value is variable.isArrayValue
in interface Value
public boolean isMapValue()
Value
asMapValue
never throws exceptions.
Note that you can't use instanceof
or cast ((MapValue) thisValue)
to check type of a value because type of a mutable value is variable.isMapValue
in interface Value
public boolean isExtensionValue()
Value
asExtensionValue
never throws exceptions.
Note that you can't use instanceof
or cast ((ExtensionValue) thisValue)
to check type of a value because
type of a mutable value is variable.isExtensionValue
in interface Value
public ImmutableNilValue asNilValue()
Value
NilValue
. Otherwise throws MessageTypeCastException
.
Note that you can't use instanceof
or cast ((NilValue) thisValue)
to check type of a value because type of a mutable value is variable.asNilValue
in interface ImmutableValue
asNilValue
in interface Value
public ImmutableBooleanValue asBooleanValue()
Value
BooleanValue
. Otherwise throws MessageTypeCastException
.
Note that you can't use instanceof
or cast ((BooleanValue) thisValue)
to check type of a value because type of a mutable value is variable.asBooleanValue
in interface ImmutableValue
asBooleanValue
in interface Value
public ImmutableFloatValue asFloatValue()
Value
FloatValue
. Otherwise throws MessageTypeCastException
.
Note that you can't use instanceof
or cast ((FloatValue) thisValue)
to check type of a value because type of a mutable value is variable.asFloatValue
in interface ImmutableValue
asFloatValue
in interface Value
public ImmutableRawValue asRawValue()
Value
RawValue
. Otherwise throws MessageTypeCastException
.
Note that you can't use instanceof
or cast ((RawValue) thisValue)
to check type of a value because type of a mutable value is variable.asRawValue
in interface ImmutableValue
asRawValue
in interface Value
public ImmutableBinaryValue asBinaryValue()
Value
BinaryValue
. Otherwise throws MessageTypeCastException
.
Note that you can't use instanceof
or cast ((BinaryValue) thisValue)
to check type of a value because type of a mutable value is variable.asBinaryValue
in interface ImmutableValue
asBinaryValue
in interface Value
public ImmutableStringValue asStringValue()
Value
StringValue
. Otherwise throws MessageTypeCastException
.
Note that you can't use instanceof
or cast ((StringValue) thisValue)
to check type of a value because type of a mutable value is variable.asStringValue
in interface ImmutableValue
asStringValue
in interface Value
public ImmutableArrayValue asArrayValue()
Value
ArrayValue
. Otherwise throws MessageTypeCastException
.
Note that you can't use instanceof
or cast ((ArrayValue) thisValue)
to check type of a value because type of a mutable value is variable.asArrayValue
in interface ImmutableValue
asArrayValue
in interface Value
public ImmutableMapValue asMapValue()
Value
MapValue
. Otherwise throws MessageTypeCastException
.
Note that you can't use instanceof
or cast ((MapValue) thisValue)
to check type of a value because type of a mutable value is variable.asMapValue
in interface ImmutableValue
asMapValue
in interface Value
public ImmutableExtensionValue asExtensionValue()
Value
ExtensionValue
. Otherwise throws MessageTypeCastException
.
Note that you can't use instanceof
or cast ((ExtensionValue) thisValue)
to check type of a value
because type of a mutable value is variable.asExtensionValue
in interface Value