public class ImmutableMapValueImpl extends AbstractImmutableValue implements ImmutableMapValue
ImmutableMapValueImpl Implements ImmutableMapValue using a Value[] field.MapValue| Modifier and Type | Class and Description |
|---|---|
private static class |
ImmutableMapValueImpl.EntryIterator |
private static class |
ImmutableMapValueImpl.EntrySet |
private static class |
ImmutableMapValueImpl.EntrySetIterator |
private static class |
ImmutableMapValueImpl.ImmutableMapValueMap |
private static class |
ImmutableMapValueImpl.KeySet |
private static class |
ImmutableMapValueImpl.ValueCollection |
| Modifier and Type | Field and Description |
|---|---|
private static ImmutableMapValueImpl |
EMPTY |
private Value[] |
kvs |
| Constructor and Description |
|---|
ImmutableMapValueImpl(Value[] kvs) |
| Modifier and Type | Method and Description |
|---|---|
private static void |
appendJsonKey(java.lang.StringBuilder sb,
Value key) |
private static void |
appendString(java.lang.StringBuilder sb,
Value value) |
ImmutableMapValue |
asMapValue()
Returns the value as
MapValue. |
static ImmutableMapValue |
empty() |
java.util.Set<java.util.Map.Entry<Value,Value>> |
entrySet() |
boolean |
equals(java.lang.Object o)
Compares this value to the specified object.
|
Value[] |
getKeyValueArray()
Returns the key-value pairs as an array of
Value. |
ValueType |
getValueType()
Returns type of this value.
|
int |
hashCode() |
ImmutableMapValue |
immutableValue()
Returns immutable copy of this value.
|
java.util.Set<Value> |
keySet() |
java.util.Map<Value,Value> |
map()
Returns the value as
Map. |
int |
size()
Returns number of key-value pairs in this array.
|
java.lang.String |
toJson()
Returns json representation of this Value.
|
java.lang.String |
toString() |
java.util.Collection<Value> |
values() |
void |
writeTo(MessagePacker pk)
Serializes the value using the specified
MessagePacker |
asArrayValue, asBinaryValue, asBooleanValue, asExtensionValue, asFloatValue, asIntegerValue, asNilValue, asNumberValue, asRawValue, asStringValue, asTimestampValue, isArrayValue, isBinaryValue, isBooleanValue, isExtensionValue, isFloatValue, isIntegerValue, isMapValue, isNilValue, isNumberValue, isRawValue, isStringValue, isTimestampValueclone, finalize, getClass, notify, notifyAll, wait, wait, waitasArrayValue, asBinaryValue, asBooleanValue, asFloatValue, asIntegerValue, asNilValue, asRawValue, asStringValue, asTimestampValueasExtensionValue, asNumberValue, isArrayValue, isBinaryValue, isBooleanValue, isExtensionValue, isFloatValue, isIntegerValue, isMapValue, isNilValue, isNumberValue, isRawValue, isStringValue, isTimestampValueprivate static final ImmutableMapValueImpl EMPTY
private final Value[] kvs
public ImmutableMapValueImpl(Value[] kvs)
public static ImmutableMapValue empty()
public ValueType getValueType()
Valueinstanceof to check type of a value because type of a mutable value is variable.getValueType in interface Valuepublic ImmutableMapValue immutableValue()
Valuethis without copying the value if this value is already immutable.immutableValue in interface Valuepublic ImmutableMapValue asMapValue()
ValueMapValue. 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.asMapValue in interface ImmutableValueasMapValue in interface ValueasMapValue in class AbstractImmutableValuepublic Value[] getKeyValueArray()
MapValueValue.
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"].getKeyValueArray in interface MapValuepublic int size()
MapValuepublic java.util.Map<Value,Value> map()
MapValueMap.public void writeTo(MessagePacker pk) throws java.io.IOException
ValueMessagePackerwriteTo in interface Valuejava.io.IOExceptionMessagePackerpublic boolean equals(java.lang.Object o)
Valuetrue if type and value are equivalent.
If this value is MapValue or ArrayValue, this method check equivalence of elements recursively.public int hashCode()
hashCode in class java.lang.Objectpublic java.lang.String toJson()
ValueFollowing behavior is not configurable at this release and they might be changed at future releases:
U+FFFD replacement character.U+FFFD replacement characterprivate static void appendJsonKey(java.lang.StringBuilder sb,
Value key)
public java.lang.String toString()
toString in class java.lang.Objectprivate static void appendString(java.lang.StringBuilder sb,
Value value)