org.apache.cassandra.serializers

## Class MapSerializer<K,V>

- java.lang.Object
- - org.apache.cassandra.serializers.CollectionSerializer<java.util.Map<K,V>>
  - - org.apache.cassandra.serializers.MapSerializer<K,V>

All Implemented Interfaces:
  TypeSerializer<java.util.Map<K,V>>

    public class MapSerializer<K,V>
    extends CollectionSerializer<java.util.Map<K,V>>

### Field Summary

Fields
`TypeSerializer<K>` `keys`
`TypeSerializer<V>` `values`

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`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 serializedMap, java.nio.ByteBuffer serializedKey, AbstractType keyType)` Given a serialized map, gets the value associated with a given key.
`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)`

### Methods inherited from class org.apache.cassandra.serializers.CollectionSerializer

`deserialize, pack, readCollectionSize, readValue, serialize, sizeOfCollectionSize, sizeOfValue, validate, writeCollectionSize, writeValue`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Methods inherited from interface org.apache.cassandra.serializers.TypeSerializer

`toCQLLiteral`

### Field Detail

#### keys

    public final TypeSerializer<K> keys

#### values

    public final TypeSerializer<V> values

### Method Detail

#### getInstance

    public static <K,V> MapSerializer<K,V> getInstance(TypeSerializer<K> keys,
                                                       TypeSerializer<V> values,
                                                       java.util.Comparator<java.nio.ByteBuffer> comparator)

#### serializeValues

    public java.util.List<java.nio.ByteBuffer> serializeValues(java.util.Map<K,V> map)

Specified by:
  `serializeValues` in class `CollectionSerializer<java.util.Map<K,V>>`

#### getElementCount

    public int getElementCount(java.util.Map<K,V> value)

Specified by:
  `getElementCount` in class `CollectionSerializer<java.util.Map<K,V>>`

#### validateForNativeProtocol

    public void validateForNativeProtocol(java.nio.ByteBuffer bytes,
                                          ProtocolVersion version)

Specified by:
  `validateForNativeProtocol` in class `CollectionSerializer<java.util.Map<K,V>>`

#### deserializeForNativeProtocol

    public java.util.Map<K,V> deserializeForNativeProtocol(java.nio.ByteBuffer bytes,
                                                           ProtocolVersion version)

Specified by:
  `deserializeForNativeProtocol` in class `CollectionSerializer<java.util.Map<K,V>>`

#### getSerializedValue

    public java.nio.ByteBuffer getSerializedValue(java.nio.ByteBuffer serializedMap,
                                                  java.nio.ByteBuffer serializedKey,
                                                  AbstractType keyType)

Given a serialized map, gets the value associated with a given key.

Parameters:
  `serializedMap` - a serialized map
  `serializedKey` - a serialized key
  `keyType` - the key type for the map
Returns:
  the value associated with the key if one exists, null otherwise

#### toString

    public java.lang.String toString(java.util.Map<K,V> value)

#### getType

    public java.lang.Class<java.util.Map<K,V>> getType()