Interface MapStore<K,​V>

  • Type Parameters:
    K - Key type for this map
    V - Value type for this map
    All Superinterfaces:
    Store

    public interface MapStore<K,​V>
    extends Store
    Interface representation of the backing store for a Map, providing its interface with the datastore.
    • Method Detail

      • keysAreEmbedded

        boolean keysAreEmbedded()
        Accessor for whether the keys are embedded.
        Returns:
        Whether we have embedded keys
      • keysAreSerialised

        boolean keysAreSerialised()
        Accessor for whether the keys are serialised.
        Returns:
        Whether we have serialised keys
      • valuesAreEmbedded

        boolean valuesAreEmbedded()
        Accessor for whether the values are embedded.
        Returns:
        Whether we have embedded values
      • valuesAreSerialised

        boolean valuesAreSerialised()
        Accessor for whether the values are serialised.
        Returns:
        Whether we have serialised values
      • containsValue

        boolean containsValue​(DNStateManager sm,
                              Object value)
        Accessor for whether the Map contains this value.
        Parameters:
        sm - StateManager for the owner of the map.
        value - The value to check
        Returns:
        Whether it is contained.
      • containsKey

        boolean containsKey​(DNStateManager sm,
                            Object key)
        Accessor for whether the Map contains this key.
        Parameters:
        sm - StateManager for the owner of the map.
        key - The key to check
        Returns:
        Whether it is contained.
      • get

        V get​(DNStateManager sm,
              Object key)
        Accessor for a value from the Map.
        Parameters:
        sm - StateManager for the owner of the map.
        key - Key for the value.
        Returns:
        Value for this key.
      • put

        V put​(DNStateManager sm,
              K key,
              V value)
        Method to add a value to the Map against this key.
        Parameters:
        sm - StateManager for the owner of the map.
        key - The key.
        value - The value.
        Returns:
        Value that was previously against this key.
      • put

        default void put​(DNStateManager sm,
                         K key,
                         V value,
                         V previousValue,
                         boolean present)
        Method to add a value to the Map against this key, where we know the previous value for the key (if present). Default implementation simply calls the put(DNStateManager, Object, Object) method. Override to provide an efficient implementation for this action.
        Parameters:
        sm - StateManager for the owner of the map.
        key - The key.
        value - The value.
        previousValue - The previous value
        present - Whether the key is present
      • putAll

        void putAll​(DNStateManager sm,
                    Map<? extends K,​? extends V> m)
        Method to add a map of values to the Map.
        Parameters:
        sm - StateManager for the owner of the map.
        m - The map to put.
      • putAll

        default void putAll​(DNStateManager<?> sm,
                            Map<? extends K,​? extends V> m,
                            Map<K,​V> previousMap)
        Method to add a map of values to the Map where we know the existing Map values prior to the putAll call.
        Parameters:
        sm - StateManager for the owner of the map.
        m - The map to add.
        previousMap - The map prior to the putAll call.
      • remove

        V remove​(DNStateManager sm,
                 Object key)
        Method to remove a value from the Map.
        Parameters:
        sm - StateManager for the owner of the map.
        key - Key whose value is to be removed.
        Returns:
        Value that was removed.
      • remove

        void remove​(DNStateManager sm,
                    Object key,
                    Object val)
        Method to remove a value from the Map where we know the value assigned to this key (to avoid lookups).
        Parameters:
        sm - StateManager for the owner of the map.
        key - Key whose value is to be removed.
        val - Value for this key when the value is known (to save the lookup)
      • clear

        void clear​(DNStateManager sm)
        Method to clear the map.
        Parameters:
        sm - StateManager for the owner of the map.
      • update

        default void update​(DNStateManager sm,
                            Map<K,​V> map)
        Method to update the map to be the supplied map of entries. Default implementation simply does a clear followed by putAll. Override this and provide an efficient implementation for this action.
        Parameters:
        sm - StateManager of the object
        map - The map to use
      • keySetStore

        SetStore<K> keySetStore()
        Accessor for a backing store representing the key set for the Map.
        Returns:
        Keys for the Map.
      • valueCollectionStore

        CollectionStore<V> valueCollectionStore()
        Accessor for a backing store representing the values in the Map.
        Returns:
        Values for the Map.
      • entrySetStore

        SetStore<Map.Entry<K,​V>> entrySetStore()
        Accessor for a backing store representing the entry set for the Map.
        Returns:
        Entry set for the Map.
      • updateEmbeddedKey

        boolean updateEmbeddedKey​(DNStateManager sm,
                                  Object key,
                                  int fieldNumber,
                                  Object newValue)
        Method to update an embedded key in the map.
        Parameters:
        sm - StateManager for the owner of the map
        key - The element
        fieldNumber - Field to update in the key
        newValue - The new value for the field
        Returns:
        Whether the element was modified
      • updateEmbeddedValue

        boolean updateEmbeddedValue​(DNStateManager sm,
                                    Object value,
                                    int fieldNumber,
                                    Object newValue)
        Method to update an embedded value in the map.
        Parameters:
        sm - StateManager for the owner of the map
        value - The element
        fieldNumber - Field to update in the value
        newValue - The new value for the field
        Returns:
        Whether the element was modified