-
- All Implemented Interfaces:
-
com.batch.android.msgpack.value.ImmutableMapValue,com.batch.android.msgpack.value.ImmutableValue,com.batch.android.msgpack.value.MapValue,com.batch.android.msgpack.value.Value
public class ImmutableMapValueImpl extends AbstractImmutableValue implements ImmutableMapValue
{@code ImmutableMapValueImpl}Implements{@code ImmutableMapValue}using a{@code Value[]}field.
-
-
Constructor Summary
Constructors Constructor Description ImmutableMapValueImpl(Array<Value> kvs)
-
Method Summary
Modifier and Type Method Description static ImmutableMapValueempty()ValueTypegetValueType()Returns type of this value. ImmutableMapValueimmutableValue()Returns immutable copy of this value. ImmutableMapValueasMapValue()Returns the value as {@code MapValue}.Array<Value>getKeyValueArray()Returns the key-value pairs as an array of {@code Value}.intsize()Returns number of key-value pairs in this array. Set<Value>keySet()Set<Map.Entry<Value, Value>>entrySet()Collection<Value>values()Map<Value, Value>map()Returns the value as {@code Map}.voidwriteTo(MessagePacker pk)Serializes the value using the specified {@code MessagePacker}booleanequals(Object o)inthashCode()StringtoJson()Returns json representation of this Value. StringtoString()-
Methods inherited from class com.batch.android.msgpack.value.impl.AbstractImmutableValue
asArrayValue, asBinaryValue, asBooleanValue, asExtensionValue, asFloatValue, asIntegerValue, 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 -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Method Detail
-
empty
static ImmutableMapValue empty()
-
getValueType
ValueType getValueType()
Returns type of this value.
Note that you can't use
instanceofto check type of a value because type of a mutable value is variable.
-
immutableValue
ImmutableMapValue immutableValue()
Returns immutable copy of this value.
This method simply returns
thiswithout copying the value if this value is already immutable.
-
asMapValue
ImmutableMapValue asMapValue()
Returns the value as
{@code MapValue}. Otherwise throws{@code MessageTypeCastException}.Note that you can't use
instanceofor cast((MapValue) thisValue)to check type of a value because type of a mutable value is variable.
-
getKeyValueArray
Array<Value> getKeyValueArray()
Returns the key-value pairs as an array of
{@code Value}.Odd elements are keys. Next element of an odd element is a value corresponding to the key.
For example, if this value represents
{"k1": "v1", "k2": "v2"}, this method returns ["k1", "v1", "k2", "v2"].
-
size
int size()
Returns number of key-value pairs in this array.
-
values
Collection<Value> values()
-
writeTo
void writeTo(MessagePacker pk)
Serializes the value using the specified
{@code MessagePacker}
-
hashCode
int hashCode()
-
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
-
-
-
-