Class ImmutableBigIntegerValueImpl

    • Constructor Detail

      • ImmutableBigIntegerValueImpl

        public ImmutableBigIntegerValueImpl​(java.math.BigInteger value)
    • Method Detail

      • getValueType

        public ValueType getValueType()
        Description copied from interface: Value
        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.
        Specified by:
        getValueType in interface Value
      • immutableValue

        public ImmutableIntegerValue immutableValue()
        Description copied from interface: Value
        Returns immutable copy of this value. This method simply returns this without copying the value if this value is already immutable.
        Specified by:
        immutableValue in interface Value
      • asNumberValue

        public ImmutableNumberValue asNumberValue()
        Description copied from interface: Value
        Returns the value as 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.
        Specified by:
        asNumberValue in interface Value
      • asIntegerValue

        public ImmutableIntegerValue asIntegerValue()
        Description copied from interface: Value
        Returns the value as 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.
        Specified by:
        asIntegerValue in interface ImmutableValue
        Specified by:
        asIntegerValue in interface Value
      • toByte

        public byte toByte()
        Description copied from interface: NumberValue
        Represent this value as a byte value, which may involve rounding or truncation of the original value. the value.
        Specified by:
        toByte in interface NumberValue
      • toShort

        public short toShort()
        Description copied from interface: NumberValue
        Represent this value as a short value, which may involve rounding or truncation of the original value.
        Specified by:
        toShort in interface NumberValue
      • toInt

        public int toInt()
        Description copied from interface: NumberValue
        Represent this value as an int value, which may involve rounding or truncation of the original value. value.
        Specified by:
        toInt in interface NumberValue
      • toLong

        public long toLong()
        Description copied from interface: NumberValue
        Represent this value as a long value, which may involve rounding or truncation of the original value.
        Specified by:
        toLong in interface NumberValue
      • toBigInteger

        public java.math.BigInteger toBigInteger()
        Description copied from interface: NumberValue
        Represent this value as a BigInteger, which may involve rounding or truncation of the original value.
        Specified by:
        toBigInteger in interface NumberValue
      • toFloat

        public float toFloat()
        Description copied from interface: NumberValue
        Represent this value as a 32-bit float value, which may involve rounding or truncation of the original value.
        Specified by:
        toFloat in interface NumberValue
      • toDouble

        public double toDouble()
        Description copied from interface: NumberValue
        Represent this value as a 64-bit double value, which may involve rounding or truncation of the original value.
        Specified by:
        toDouble in interface NumberValue
      • isInByteRange

        public boolean isInByteRange()
        Description copied from interface: IntegerValue
        Returns true if the value is in the range of [-27 to 27-1].
        Specified by:
        isInByteRange in interface IntegerValue
      • isInShortRange

        public boolean isInShortRange()
        Description copied from interface: IntegerValue
        Returns true if the value is in the range of [-215 to 215-1]
        Specified by:
        isInShortRange in interface IntegerValue
      • isInIntRange

        public boolean isInIntRange()
        Description copied from interface: IntegerValue
        Returns true if the value is in the range of [-231 to 231-1]
        Specified by:
        isInIntRange in interface IntegerValue
      • isInLongRange

        public boolean isInLongRange()
        Description copied from interface: IntegerValue
        Returns true if the value is in the range of [-263 to 263-1]
        Specified by:
        isInLongRange in interface IntegerValue
      • mostSuccinctMessageFormat

        public MessageFormat mostSuccinctMessageFormat()
        Description copied from interface: IntegerValue
        Returns the most succinct MessageFormat type to represent this integer value.
        Specified by:
        mostSuccinctMessageFormat in interface IntegerValue
        Returns:
        the smallest integer type of MessageFormat that is big enough to store the value.
      • asByte

        public byte asByte()
        Description copied from interface: IntegerValue
        Returns the value as a byte, otherwise throws an exception.
        Specified by:
        asByte in interface IntegerValue
      • asShort

        public short asShort()
        Description copied from interface: IntegerValue
        Returns the value as a short, otherwise throws an exception.
        Specified by:
        asShort in interface IntegerValue
      • asInt

        public int asInt()
        Description copied from interface: IntegerValue
        Returns the value as an int, otherwise throws an exception.
        Specified by:
        asInt in interface IntegerValue
      • asLong

        public long asLong()
        Description copied from interface: IntegerValue
        Returns the value as a long, otherwise throws an exception.
        Specified by:
        asLong in interface IntegerValue
      • asBigInteger

        public java.math.BigInteger asBigInteger()
        Description copied from interface: IntegerValue
        Returns the value as a BigInteger.
        Specified by:
        asBigInteger in interface IntegerValue
      • writeTo

        public void writeTo​(MessagePacker pk)
                     throws java.io.IOException
        Description copied from interface: Value
        Serializes the value using the specified MessagePacker
        Specified by:
        writeTo in interface Value
        Throws:
        java.io.IOException
        See Also:
        MessagePacker
      • equals

        public boolean equals​(java.lang.Object o)
        Description copied from interface: Value
        Compares this value to the specified object. This method returns true if type and value are equivalent. If this value is MapValue or ArrayValue, this method check equivalence of elements recursively.
        Specified by:
        equals in interface Value
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toJson

        public java.lang.String toJson()
        Description copied from interface: Value
        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
          Specified by:
          toJson in interface Value
        • toString

          public java.lang.String toString()
          Overrides:
          toString in class java.lang.Object
        • isNilValue

          public boolean isNilValue()
          Description copied from interface: Value
          Returns true if type of this value is Nil. If this method returns true, 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.
          Specified by:
          isNilValue in interface Value
        • isBooleanValue

          public boolean isBooleanValue()
          Description copied from interface: Value
          Returns true if type of this value is Boolean. If this method returns true, 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.
          Specified by:
          isBooleanValue in interface Value
        • isNumberValue

          public boolean isNumberValue()
          Description copied from interface: Value
          Returns true if type of this value is Integer or Float. If this method returns true, 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.
          Specified by:
          isNumberValue in interface Value
        • isIntegerValue

          public boolean isIntegerValue()
          Description copied from interface: Value
          Returns true if type of this value is Integer. If this method returns true, 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.
          Specified by:
          isIntegerValue in interface Value
        • isFloatValue

          public boolean isFloatValue()
          Description copied from interface: Value
          Returns true if type of this value is Float. If this method returns true, 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.
          Specified by:
          isFloatValue in interface Value
        • isRawValue

          public boolean isRawValue()
          Description copied from interface: Value
          Returns true if type of this value is String or Binary. If this method returns true, 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.
          Specified by:
          isRawValue in interface Value
        • isBinaryValue

          public boolean isBinaryValue()
          Description copied from interface: Value
          Returns true if type of this value is Binary. If this method returns true, 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.
          Specified by:
          isBinaryValue in interface Value
        • isStringValue

          public boolean isStringValue()
          Description copied from interface: Value
          Returns true if type of this value is String. If this method returns true, 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.
          Specified by:
          isStringValue in interface Value
        • isArrayValue

          public boolean isArrayValue()
          Description copied from interface: Value
          Returns true if type of this value is Array. If this method returns true, 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.
          Specified by:
          isArrayValue in interface Value
        • isMapValue

          public boolean isMapValue()
          Description copied from interface: Value
          Returns true if type of this value is Map. If this method returns true, 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.
          Specified by:
          isMapValue in interface Value
        • isExtensionValue

          public boolean isExtensionValue()
          Description copied from interface: Value
          Returns true if type of this an Extension. If this method returns true, 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.
          Specified by:
          isExtensionValue in interface Value
        • asNilValue

          public ImmutableNilValue asNilValue()
          Description copied from interface: Value
          Returns the value as 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.
          Specified by:
          asNilValue in interface ImmutableValue
          Specified by:
          asNilValue in interface Value
        • asBooleanValue

          public ImmutableBooleanValue asBooleanValue()
          Description copied from interface: Value
          Returns the value as 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.
          Specified by:
          asBooleanValue in interface ImmutableValue
          Specified by:
          asBooleanValue in interface Value
        • asFloatValue

          public ImmutableFloatValue asFloatValue()
          Description copied from interface: Value
          Returns the value as 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.
          Specified by:
          asFloatValue in interface ImmutableValue
          Specified by:
          asFloatValue in interface Value
        • asRawValue

          public ImmutableRawValue asRawValue()
          Description copied from interface: Value
          Returns the value as 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.
          Specified by:
          asRawValue in interface ImmutableValue
          Specified by:
          asRawValue in interface Value
        • asBinaryValue

          public ImmutableBinaryValue asBinaryValue()
          Description copied from interface: Value
          Returns the value as 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.
          Specified by:
          asBinaryValue in interface ImmutableValue
          Specified by:
          asBinaryValue in interface Value
        • asStringValue

          public ImmutableStringValue asStringValue()
          Description copied from interface: Value
          Returns the value as 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.
          Specified by:
          asStringValue in interface ImmutableValue
          Specified by:
          asStringValue in interface Value
        • asArrayValue

          public ImmutableArrayValue asArrayValue()
          Description copied from interface: Value
          Returns the value as 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.
          Specified by:
          asArrayValue in interface ImmutableValue
          Specified by:
          asArrayValue in interface Value
        • asMapValue

          public ImmutableMapValue asMapValue()
          Description copied from interface: Value
          Returns the value as 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.
          Specified by:
          asMapValue in interface ImmutableValue
          Specified by:
          asMapValue in interface Value
        • asExtensionValue

          public ImmutableExtensionValue asExtensionValue()
          Description copied from interface: Value
          Returns the value as 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.
          Specified by:
          asExtensionValue in interface Value