K
- The type of the keys in the map.V
- The type of the values in the map.@Internal public final class HashMapSerializer<K,V> extends TypeSerializer<HashMap<K,V>>
HashMap
. The serializer relies on a key serializer and a value serializer
for the serialization of the map's key-value pairs.
The serialization format for the map is as follows: four bytes for the length of the map, followed by the serialized representation of each key-value pair. To allow null values, each value is prefixed by a null marker.
Constructor and Description |
---|
HashMapSerializer(TypeSerializer<K> keySerializer,
TypeSerializer<V> valueSerializer)
Creates a map serializer that uses the given serializers to serialize the key-value pairs in the map.
|
Modifier and Type | Method and Description |
---|---|
boolean |
canEqual(Object obj) |
void |
copy(DataInputView source,
DataOutputView target) |
HashMap<K,V> |
copy(HashMap<K,V> from) |
HashMap<K,V> |
copy(HashMap<K,V> from,
HashMap<K,V> reuse) |
HashMap<K,V> |
createInstance() |
HashMap<K,V> |
deserialize(DataInputView source) |
HashMap<K,V> |
deserialize(HashMap<K,V> reuse,
DataInputView source) |
TypeSerializer<HashMap<K,V>> |
duplicate() |
CompatibilityResult<HashMap<K,V>> |
ensureCompatibility(TypeSerializerConfigSnapshot configSnapshot) |
boolean |
equals(Object obj) |
TypeSerializer<K> |
getKeySerializer() |
int |
getLength() |
TypeSerializer<V> |
getValueSerializer() |
int |
hashCode() |
boolean |
isImmutableType() |
void |
serialize(HashMap<K,V> map,
DataOutputView target) |
TypeSerializerConfigSnapshot |
snapshotConfiguration() |
public HashMapSerializer(TypeSerializer<K> keySerializer, TypeSerializer<V> valueSerializer)
keySerializer
- The serializer for the keys in the mapvalueSerializer
- The serializer for the values in the mappublic TypeSerializer<K> getKeySerializer()
public TypeSerializer<V> getValueSerializer()
public boolean isImmutableType()
isImmutableType
in class TypeSerializer<HashMap<K,V>>
public TypeSerializer<HashMap<K,V>> duplicate()
duplicate
in interface TypeDeserializer<HashMap<K,V>>
duplicate
in class TypeSerializer<HashMap<K,V>>
public HashMap<K,V> createInstance()
createInstance
in class TypeSerializer<HashMap<K,V>>
public HashMap<K,V> copy(HashMap<K,V> from)
copy
in class TypeSerializer<HashMap<K,V>>
public HashMap<K,V> copy(HashMap<K,V> from, HashMap<K,V> reuse)
copy
in class TypeSerializer<HashMap<K,V>>
public int getLength()
getLength
in interface TypeDeserializer<HashMap<K,V>>
getLength
in class TypeSerializer<HashMap<K,V>>
public void serialize(HashMap<K,V> map, DataOutputView target) throws IOException
serialize
in class TypeSerializer<HashMap<K,V>>
IOException
public HashMap<K,V> deserialize(DataInputView source) throws IOException
deserialize
in interface TypeDeserializer<HashMap<K,V>>
deserialize
in class TypeSerializer<HashMap<K,V>>
IOException
public HashMap<K,V> deserialize(HashMap<K,V> reuse, DataInputView source) throws IOException
deserialize
in interface TypeDeserializer<HashMap<K,V>>
deserialize
in class TypeSerializer<HashMap<K,V>>
IOException
public void copy(DataInputView source, DataOutputView target) throws IOException
copy
in class TypeSerializer<HashMap<K,V>>
IOException
public boolean equals(Object obj)
equals
in interface TypeDeserializer<HashMap<K,V>>
equals
in class TypeSerializer<HashMap<K,V>>
public boolean canEqual(Object obj)
canEqual
in interface TypeDeserializer<HashMap<K,V>>
canEqual
in class TypeSerializer<HashMap<K,V>>
public int hashCode()
hashCode
in interface TypeDeserializer<HashMap<K,V>>
hashCode
in class TypeSerializer<HashMap<K,V>>
public TypeSerializerConfigSnapshot snapshotConfiguration()
snapshotConfiguration
in class TypeSerializer<HashMap<K,V>>
public CompatibilityResult<HashMap<K,V>> ensureCompatibility(TypeSerializerConfigSnapshot configSnapshot)
ensureCompatibility
in class TypeSerializer<HashMap<K,V>>
Copyright © 2014–2017 The Apache Software Foundation. All rights reserved.