Interface MapStore<K,V>
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description void
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.SetStore<Map.Entry<K,V>>
entrySetStore()
Accessor for a backing store representing the entry set for the Map.V
get(DNStateManager sm, Object key)
Accessor for a value from the Map.boolean
keysAreEmbedded()
Accessor for whether the keys are embedded.boolean
keysAreSerialised()
Accessor for whether the keys are serialised.SetStore<K>
keySetStore()
Accessor for a backing store representing the key set for the Map.V
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
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.void
putAll(DNStateManager sm, Map<? extends K,? extends V> m)
Method to add a map of values to the Map.V
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.CollectionStore<V>
valueCollectionStore()
Accessor for a backing store representing the values in the Map.boolean
valuesAreEmbedded()
Accessor for whether the values are embedded.boolean
valuesAreSerialised()
Accessor for whether the values are serialised.-
Methods inherited from interface org.datanucleus.store.types.scostore.Store
getOwnerMemberMetaData, getStoreManager
-
-
-
-
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 valuepresent
- 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 objectmap
- 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 mapkey
- The elementfieldNumber
- Field to update in the keynewValue
- 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 mapvalue
- The elementfieldNumber
- Field to update in the valuenewValue
- The new value for the field- Returns:
- Whether the element was modified
-
-