public class MapSerializer<K,V> extends CollectionSerializer<java.util.Map<K,V>>
| Modifier and Type | Field and Description |
|---|---|
TypeSerializer<K> |
keys |
TypeSerializer<V> |
values |
| Modifier and Type | Method and Description |
|---|---|
java.util.Map<K,V> |
deserializeForNativeProtocol(java.nio.ByteBuffer bytes,
ProtocolVersion version) |
int |
getElementCount(java.util.Map<K,V> value) |
static <K,V> MapSerializer<K,V> |
getInstance(TypeSerializer<K> keys,
TypeSerializer<V> values,
java.util.Comparator<java.nio.ByteBuffer> comparator) |
java.nio.ByteBuffer |
getSerializedValue(java.nio.ByteBuffer collection,
java.nio.ByteBuffer key,
AbstractType<?> comparator)
Extract an element from a serialized collection.
|
java.nio.ByteBuffer |
getSliceFromSerialized(java.nio.ByteBuffer collection,
java.nio.ByteBuffer from,
java.nio.ByteBuffer to,
AbstractType<?> comparator,
boolean frozen)
Returns the slice of a collection directly from its serialized value.
|
java.lang.Class<java.util.Map<K,V>> |
getType() |
java.util.List<java.nio.ByteBuffer> |
serializeValues(java.util.Map<K,V> map) |
java.lang.String |
toString(java.util.Map<K,V> value) |
void |
validateForNativeProtocol(java.nio.ByteBuffer bytes,
ProtocolVersion version) |
copyAsNewCollection, deserialize, pack, readCollectionSize, readValue, serialize, sizeOfCollectionSize, sizeOfValue, skipValue, validate, writeCollectionSize, writeValueclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waittoCQLLiteralpublic final TypeSerializer<K> keys
public final TypeSerializer<V> values
public static <K,V> MapSerializer<K,V> getInstance(TypeSerializer<K> keys, TypeSerializer<V> values, java.util.Comparator<java.nio.ByteBuffer> comparator)
public java.util.List<java.nio.ByteBuffer> serializeValues(java.util.Map<K,V> map)
serializeValues in class CollectionSerializer<java.util.Map<K,V>>public int getElementCount(java.util.Map<K,V> value)
getElementCount in class CollectionSerializer<java.util.Map<K,V>>public void validateForNativeProtocol(java.nio.ByteBuffer bytes,
ProtocolVersion version)
validateForNativeProtocol in class CollectionSerializer<java.util.Map<K,V>>public java.util.Map<K,V> deserializeForNativeProtocol(java.nio.ByteBuffer bytes, ProtocolVersion version)
deserializeForNativeProtocol in class CollectionSerializer<java.util.Map<K,V>>public java.nio.ByteBuffer getSerializedValue(java.nio.ByteBuffer collection,
java.nio.ByteBuffer key,
AbstractType<?> comparator)
CollectionSerializer
Note that this is only supported to sets and maps. For sets, this mostly ends up being
a check for the presence of the provide key: it will return the key if it's present and
null otherwise.
getSerializedValue in class CollectionSerializer<java.util.Map<K,V>>collection - the serialized collection. This cannot be null.key - the key to extract (This cannot be null nor ByteBufferUtil.UNSET_BYTE_BUFFER).comparator - the type to use to compare the key value to those
in the collection.key if one exists, null otherwisepublic java.nio.ByteBuffer getSliceFromSerialized(java.nio.ByteBuffer collection,
java.nio.ByteBuffer from,
java.nio.ByteBuffer to,
AbstractType<?> comparator,
boolean frozen)
CollectionSerializerIf the slice contains no elements an empty collection will be returned for frozen collections, and a
null one for non-frozen collections.
getSliceFromSerialized in class CollectionSerializer<java.util.Map<K,V>>collection - the serialized collection. This cannot be null.from - the left bound of the slice to extract. This cannot be null but if this is
ByteBufferUtil.UNSET_BYTE_BUFFER, then the returned slice starts at the beginning
of collection.comparator - the type to use to compare the from and to values to those
in the collection.frozen - true if the collection is a frozen one, false otherwise[from, to] of collection.Copyright © 2009-2019 The Apache Software Foundation