Package 

Class ImmutableBooleanValueImpl

  • All Implemented Interfaces:
    com.batch.android.msgpack.value.BooleanValue , com.batch.android.msgpack.value.ImmutableBooleanValue , com.batch.android.msgpack.value.ImmutableValue , com.batch.android.msgpack.value.Value

    
    public class ImmutableBooleanValueImpl
    extends AbstractImmutableValue implements ImmutableBooleanValue
                        

    {@code ImmutableBooleanValueImpl} Implements {@code ImmutableBooleanValue} using a {@code boolean} field.

    This class is a singleton. {@code ImmutableBooleanValueImpl.trueInstance()} and {@code ImmutableBooleanValueImpl.falseInstance()} are the only instances of this class.

    • Method Summary

      Modifier and Type Method Description
      ValueType getValueType() Returns type of this value.
      ImmutableBooleanValue asBooleanValue() Returns the value as {@code BooleanValue}.
      ImmutableBooleanValue immutableValue() Returns immutable copy of this value.
      boolean getBoolean() Returns the value as a {@code boolean}.
      void writeTo(MessagePacker packer) 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, asExtensionValue, asFloatValue, asIntegerValue, asMapValue, asNilValue, asNumberValue, 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, writeTo
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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.

      • asBooleanValue

         ImmutableBooleanValue asBooleanValue()

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

      • immutableValue

         ImmutableBooleanValue immutableValue()

        Returns immutable copy of this value.

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

      • getBoolean

         boolean getBoolean()

        Returns the value as a {@code boolean}.

      • writeTo

         void writeTo(MessagePacker packer)

        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