Package 

Class ImmutableLongValueImpl

  • All Implemented Interfaces:
    com.batch.android.msgpack.value.ImmutableIntegerValue , com.batch.android.msgpack.value.ImmutableNumberValue , com.batch.android.msgpack.value.ImmutableValue , com.batch.android.msgpack.value.IntegerValue , com.batch.android.msgpack.value.NumberValue , com.batch.android.msgpack.value.Value

    
    public class ImmutableLongValueImpl
    extends AbstractImmutableValue implements ImmutableIntegerValue
                        

    {@code ImmutableLongValueImpl} Implements {@code ImmutableIntegerValue} using a {@code long} field.

    • Method Summary

      Modifier and Type Method Description
      ValueType getValueType() Returns type of this value.
      ImmutableIntegerValue immutableValue() Returns immutable copy of this value.
      ImmutableNumberValue asNumberValue() Returns the value as {@code NumberValue}.
      ImmutableIntegerValue asIntegerValue() Returns the value as {@code IntegerValue}.
      byte toByte() Represent this value as a byte value, which may involve rounding or truncation of the original value.the value.
      short toShort() Represent this value as a short 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.value.
      long toLong() Represent this value as a long value, which may involve rounding or truncation of the original value.
      BigInteger toBigInteger() Represent this value as a BigInteger, 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.
      double toDouble() Represent this value as a 64-bit double value, which may involve rounding or truncation of the original value.
      boolean isInByteRange() Returns true if the value is in the range of [-27 to 27-1].
      boolean isInShortRange() Returns true if the value is in the range of [-215 to 215-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]
      MessageFormat mostSuccinctMessageFormat() Returns the most succinct MessageFormat type to represent this integer value.
      byte asByte() Returns the value as a {@code byte}, otherwise throws an exception.
      short asShort() Returns the value as a {@code short}, otherwise throws an exception.
      int asInt() Returns the value as an {@code int}, otherwise throws an exception.
      long asLong() Returns the value as a {@code long}, otherwise throws an exception.
      BigInteger asBigInteger() Returns the value as a {@code BigInteger}.
      void writeTo(MessagePacker pk) Serializes the value using the specified {@code MessagePacker}
      boolean equals(Object o)
      int hashCode()
      String toJson() Returns json representation of this Value.
      String toString()
      • Methods inherited from class com.batch.android.msgpack.value.impl.AbstractImmutableValue

        asArrayValue, asBinaryValue, asBooleanValue, asExtensionValue, asFloatValue, asMapValue, asNilValue, asRawValue, asStringValue, isArrayValue, isBinaryValue, isBooleanValue, isExtensionValue, isFloatValue, isIntegerValue, isMapValue, isNilValue, isNumberValue, isRawValue, isStringValue
      • Methods inherited from class com.batch.android.msgpack.value.Value

        asArrayValue, asBinaryValue, asBooleanValue, asExtensionValue, asFloatValue, asIntegerValue, asMapValue, asNilValue, asNumberValue, asRawValue, asStringValue, equals, immutableValue
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ImmutableLongValueImpl

        ImmutableLongValueImpl(long value)
    • Method Detail

      • getValueType

         ValueType getValueType()

        Returns type of this value.

        Note that you can't use instanceof to check type of a value because type of a mutable value is variable.

      • immutableValue

         ImmutableIntegerValue immutableValue()

        Returns immutable copy of this value.

        This method simply returns this without copying the value if this value is already immutable.

      • asNumberValue

         ImmutableNumberValue asNumberValue()

        Returns the value as {@code NumberValue}. Otherwise throws {@code 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.

      • asIntegerValue

         ImmutableIntegerValue asIntegerValue()

        Returns the value as {@code IntegerValue}. Otherwise throws {@code 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.

      • toByte

         byte toByte()

        Represent this value as a byte value, which may involve rounding or truncation of the original value.the value.

      • toShort

         short toShort()

        Represent this value as a short value, which may involve rounding or truncation of the original value.

      • toInt

         int toInt()

        Represent this value as an int value, which may involve rounding or truncation of the original value.value.

      • toLong

         long toLong()

        Represent this value as a long value, which may involve rounding or truncation of the original value.

      • toBigInteger

         BigInteger toBigInteger()

        Represent this value as a BigInteger, which may involve rounding or truncation of the original value.

      • toFloat

         float toFloat()

        Represent this value as a 32-bit float value, which may involve rounding or truncation of the original value.

      • toDouble

         double toDouble()

        Represent this value as a 64-bit double value, which may involve rounding or truncation of the original value.

      • isInByteRange

         boolean isInByteRange()

        Returns true if the value is in the range of [-27 to 27-1].

      • isInShortRange

         boolean isInShortRange()

        Returns true if the value is in the range of [-215 to 215-1]

      • isInIntRange

         boolean isInIntRange()

        Returns true if the value is in the range of [-231 to 231-1]

      • isInLongRange

         boolean isInLongRange()

        Returns true if the value is in the range of [-263 to 263-1]

      • asByte

         byte asByte()

        Returns the value as a {@code byte}, otherwise throws an exception.

      • asShort

         short asShort()

        Returns the value as a {@code short}, otherwise throws an exception.

      • asInt

         int asInt()

        Returns the value as an {@code int}, otherwise throws an exception.

      • asLong

         long asLong()

        Returns the value as a {@code long}, otherwise throws an exception.

      • writeTo

         void writeTo(MessagePacker pk)

        Serializes the value using the specified {@code MessagePacker}

      • toJson

         String toJson()

        Returns json representation of this Value.

        Following behavior is not configurable at this release and they might be changed at future releases:

        • if a key of MapValue is not string, the key is converted to a string using toString method.
        • NaN and Infinity of DoubleValue are converted to null.
        • ExtensionValue is converted to a 2-element array where first element is a number and second element is the data encoded in hex.
        • BinaryValue is converted to a string using UTF-8 encoding. Invalid byte sequence is replaced with U+FFFD replacement character.
        • Invalid UTF-8 byte sequences in StringValue is replaced with U+FFFD replacement character