Class AbstractMapStore<K,V>
java.lang.Object
org.datanucleus.store.rdbms.scostore.BaseContainerStore
org.datanucleus.store.rdbms.scostore.AbstractMapStore<K,V>
- All Implemented Interfaces:
org.datanucleus.store.types.scostore.MapStore<K,
,V> org.datanucleus.store.types.scostore.Store
- Direct Known Subclasses:
FKMapStore
,JoinMapStore
public abstract class AbstractMapStore<K,V>
extends BaseContainerStore
implements org.datanucleus.store.types.scostore.MapStore<K,V>
Abstract representation of the backing store for a Map.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected String
protected boolean
Flag to set whether the iterator statement will use a discriminator or not.protected org.datanucleus.metadata.AbstractClassMetaData
Metadata for the keys (if persistable).protected JavaTypeMapping
Mapping to the key from the mapTable.protected boolean
Whether the keys are embedded.protected boolean
Whether the keys are serialised.protected String
Type of the key.protected org.datanucleus.metadata.AbstractClassMetaData
Metadata for the values (if persistable).protected JavaTypeMapping
Mapping to the value from the mapTable.protected boolean
Whether the values are embedded.protected boolean
Whether the values are serialised.protected String
Type of the value.Fields inherited from class org.datanucleus.store.rdbms.scostore.BaseContainerStore
allowNulls, clr, dba, ownerMapping, ownerMemberMetaData, relationType, storeMgr
-
Constructor Summary
ConstructorsConstructorDescriptionAbstractMapStore
(RDBMSStoreManager storeMgr, org.datanucleus.ClassLoaderResolver clr) -
Method Summary
Modifier and TypeMethodDescriptionboolean
containsKey
(org.datanucleus.state.DNStateManager sm, Object key) boolean
containsValue
(org.datanucleus.state.DNStateManager sm, Object value) protected static String
getContainsValueStmt
(JavaTypeMapping ownerMapping, JavaTypeMapping valueMapping, Table mapTable) Generate statement to check if a value is contained in the Map.org.datanucleus.metadata.AbstractClassMetaData
protected abstract V
Method to retrieve a value from the Map given the key.org.datanucleus.metadata.AbstractClassMetaData
boolean
Accessor for whether the keys are embedded or not.boolean
Accessor for whether the keys are serialised or not.void
protected boolean
validateKeyForReading
(org.datanucleus.state.DNStateManager sm, Object key) Utility to validate a key is ok for reading.protected void
validateKeyForWriting
(org.datanucleus.state.DNStateManager ownerSM, Object key) Utility to validate a key is ok for writing (present in the datastore).protected void
validateKeyType
(org.datanucleus.ClassLoaderResolver clr, Object key) Utility to validate the type of a key for storing in the Map.protected boolean
validateValueForReading
(org.datanucleus.state.DNStateManager sm, Object value) Utility to validate a value is ok for reading.protected void
validateValueForWriting
(org.datanucleus.state.DNStateManager ownerSM, Object value) Utility to validate a value is ok for writing (present in the datastore).protected void
validateValueType
(org.datanucleus.ClassLoaderResolver clr, Object value) Utility to validate the type of a value for storing in the Map.boolean
Accessor for whether the values are embedded or not.boolean
Accessor for whether the values are serialised or not.Methods inherited from class org.datanucleus.store.rdbms.scostore.BaseContainerStore
allowsBatching, getComponentInformationForClass, getDatastoreAdapter, getOwnerMapping, getOwnerMemberMetaData, getRelationType, getStateManagerForEmbeddedPCObject, getStoreManager, isEmbeddedMapping, setOwner
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.datanucleus.store.types.scostore.MapStore
clear, entrySetStore, keySetStore, put, put, putAll, remove, remove, update, updateEmbeddedKey, updateEmbeddedValue, valueCollectionStore
Methods inherited from interface org.datanucleus.store.types.scostore.Store
getOwnerMemberMetaData, getStoreManager
-
Field Details
-
iterateUsingDiscriminator
protected boolean iterateUsingDiscriminatorFlag to set whether the iterator statement will use a discriminator or not. -
keyCmd
protected org.datanucleus.metadata.AbstractClassMetaData keyCmdMetadata for the keys (if persistable). -
valueCmd
protected org.datanucleus.metadata.AbstractClassMetaData valueCmdMetadata for the values (if persistable). -
keyMapping
Mapping to the key from the mapTable. -
valueMapping
Mapping to the value from the mapTable. -
keyType
Type of the key. -
valueType
Type of the value. -
keysAreEmbedded
protected boolean keysAreEmbeddedWhether the keys are embedded. -
keysAreSerialised
protected boolean keysAreSerialisedWhether the keys are serialised. -
valuesAreEmbedded
protected boolean valuesAreEmbeddedWhether the values are embedded. -
valuesAreSerialised
protected boolean valuesAreSerialisedWhether the values are serialised. -
containsValueStmt
-
-
Constructor Details
-
AbstractMapStore
-
-
Method Details
-
getValueMapping
-
getKeyMapping
-
getKeyClassMetaData
public org.datanucleus.metadata.AbstractClassMetaData getKeyClassMetaData() -
getValueClassMetaData
public org.datanucleus.metadata.AbstractClassMetaData getValueClassMetaData() -
keysAreEmbedded
public boolean keysAreEmbedded()Accessor for whether the keys are embedded or not. If they are PC instances then returns false; -
keysAreSerialised
public boolean keysAreSerialised()Accessor for whether the keys are serialised or not. If they are PC instances then returns false; -
valuesAreEmbedded
public boolean valuesAreEmbedded()Accessor for whether the values are embedded or not. If they are PC instances then returns false; -
valuesAreSerialised
public boolean valuesAreSerialised()Accessor for whether the values are serialised or not. If they are PC instances then returns false; -
containsKey
-
containsValue
-
get
-
putAll
-
validateKeyType
Utility to validate the type of a key for storing in the Map.- Parameters:
clr
- The ClassLoaderResolverkey
- The key to check.
-
validateValueType
Utility to validate the type of a value for storing in the Map.- Parameters:
clr
- The ClassLoaderResolvervalue
- The value to check.
-
validateKeyForReading
Utility to validate a key is ok for reading.- Parameters:
sm
- StateManager for the map.key
- The key to check.- Returns:
- Whether it is validated.
-
validateValueForReading
Utility to validate a value is ok for reading.- Parameters:
sm
- StateManager for the map.value
- The value to check.- Returns:
- Whether it is validated.
-
validateKeyForWriting
Utility to validate a key is ok for writing (present in the datastore).- Parameters:
ownerSM
- StateManager for the owner of the mapkey
- The key to check.
-
validateValueForWriting
Utility to validate a value is ok for writing (present in the datastore).- Parameters:
ownerSM
- StateManager for the owner of the mapvalue
- The value to check.
-
getValue
protected abstract V getValue(org.datanucleus.state.DNStateManager sm, Object key) throws NoSuchElementException Method to retrieve a value from the Map given the key.- Parameters:
sm
- StateManager for the map.key
- The key to retrieve the value for.- Returns:
- The value for this key
- Throws:
NoSuchElementException
- if the value for the key was not found
-
getContainsValueStmt
protected static String getContainsValueStmt(JavaTypeMapping ownerMapping, JavaTypeMapping valueMapping, Table mapTable) Generate statement to check if a value is contained in the Map.SELECT OWNERCOL FROM MAPTABLE WHERE OWNERCOL=? AND VALUECOL = ?
- Parameters:
ownerMapping
- the owner mappingvalueMapping
- the value mappingmapTable
- the map table- Returns:
- Statement to check if a value is contained in the Map.
-