Interface MapStore<K,V>
- Type Parameters:
K
- Key type for this mapV
- Value type for this map
- All Superinterfaces:
Store
Interface representation of the backing store for a Map, providing its interface with the datastore.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
clear
(DNStateManager sm) Method to clear the map.boolean
containsKey
(DNStateManager sm, Object key) Accessor for whether the Map contains this key.boolean
containsValue
(DNStateManager sm, Object value) Accessor for whether the Map contains this value.Accessor for a backing store representing the entry set for the Map.get
(DNStateManager sm, Object key) Accessor for a value from the Map.boolean
Accessor for whether the keys are embedded.boolean
Accessor for whether the keys are serialised.Accessor for a backing store representing the key set for the Map.put
(DNStateManager sm, K key, V value) Method to add a value to the Map against this key.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 void
Method to add a map of values to the Map where we know the existing Map values prior to the putAll call.void
putAll
(DNStateManager sm, Map<? extends K, ? extends V> m) Method to add a map of values to the Map.remove
(DNStateManager sm, Object key) Method to remove a value from the Map.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).default void
update
(DNStateManager sm, Map<K, V> map) Method to update the map to be the supplied map of entries.boolean
updateEmbeddedKey
(DNStateManager sm, Object key, int fieldNumber, Object newValue) Method to update an embedded key in the map.boolean
updateEmbeddedValue
(DNStateManager sm, Object value, int fieldNumber, Object newValue) Method to update an embedded value in the map.Accessor for a backing store representing the values in the Map.boolean
Accessor for whether the values are embedded.boolean
Accessor for whether the values are serialised.Methods inherited from interface org.datanucleus.store.types.scostore.Store
getOwnerMemberMetaData, getStoreManager
-
Method Details
-
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
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
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
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
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
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 valuepresent
- Whether the key is present
-
putAll
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
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
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
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
Method to clear the map.- Parameters:
sm
- StateManager for the owner of the map.
-
update
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 objectmap
- The map to use
-
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
Accessor for a backing store representing the entry set for the Map.- Returns:
- Entry set for the Map.
-
updateEmbeddedKey
Method to update an embedded key in the map.- Parameters:
sm
- StateManager for the owner of the mapkey
- The elementfieldNumber
- Field to update in the keynewValue
- The new value for the field- Returns:
- Whether the element was modified
-
updateEmbeddedValue
Method to update an embedded value in the map.- Parameters:
sm
- StateManager for the owner of the mapvalue
- The elementfieldNumber
- Field to update in the valuenewValue
- The new value for the field- Returns:
- Whether the element was modified
-