Class ImmutableExtensionValueImpl

    • Constructor Detail

      • ImmutableExtensionValueImpl

        public ImmutableExtensionValueImpl​(byte type,
                                           byte[] data)
    • 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 ImmutableExtensionValue 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
      • 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
      • writeTo

        public void writeTo​(MessagePacker packer)
                     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
        • 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
        • 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