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
    Modifier and Type | Field and Description
    --- | ---
    `TypeSerializer<K>` | `keys`
    `TypeSerializer<V>` | `values`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.util.Map<K,V>` | `deserializeForNativeProtocol(java.nio.ByteBuffer bytes, int version)`
    `int` | `getElementCount(java.util.Map<K,V> value)`
    `static <K,V> MapSerializer<K,V>` | `getInstance(TypeSerializer<K> keys, TypeSerializer<V> values)`
    `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, int version)`

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

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

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

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

- - ### 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)

    - #### 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,
                                                int version)

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

    - #### deserializeForNativeProtocol

          public java.util.Map<K,V> deserializeForNativeProtocol(java.nio.ByteBuffer bytes,
                                                                 int 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()

Copyright © 2018 The Apache Software Foundation