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 Stringprotected booleanFlag to set whether the iterator statement will use a discriminator or not.protected org.datanucleus.metadata.AbstractClassMetaDataMetadata for the keys (if persistable).protected JavaTypeMappingMapping to the key from the mapTable.protected booleanWhether the keys are embedded.protected booleanWhether the keys are serialised.protected StringType of the key.protected org.datanucleus.metadata.AbstractClassMetaDataMetadata for the values (if persistable).protected JavaTypeMappingMapping to the value from the mapTable.protected booleanWhether the values are embedded.protected booleanWhether the values are serialised.protected StringType of the value.Fields inherited from class BaseContainerStore
allowNulls, clr, dba, ownerMapping, ownerMemberMetaData, relationType, storeMgr -
Constructor Summary
ConstructorsConstructorDescriptionAbstractMapStore(RDBMSStoreManager storeMgr, org.datanucleus.ClassLoaderResolver clr) -
Method Summary
Modifier and TypeMethodDescriptionbooleancontainsKey(org.datanucleus.state.DNStateManager sm, Object key) booleancontainsValue(org.datanucleus.state.DNStateManager sm, Object value) protected static StringgetContainsValueStmt(JavaTypeMapping ownerMapping, JavaTypeMapping valueMapping, Table mapTable) Generate statement to check if a value is contained in the Map.org.datanucleus.metadata.AbstractClassMetaDataprotected abstract VMethod to retrieve a value from the Map given the key.org.datanucleus.metadata.AbstractClassMetaDatabooleanAccessor for whether the keys are embedded or not.booleanAccessor for whether the keys are serialised or not.voidprotected booleanvalidateKeyForReading(org.datanucleus.state.DNStateManager sm, Object key) Utility to validate a key is ok for reading.protected voidvalidateKeyForWriting(org.datanucleus.state.DNStateManager ownerSM, Object key) Utility to validate a key is ok for writing (present in the datastore).protected voidvalidateKeyType(org.datanucleus.ClassLoaderResolver clr, Object key) Utility to validate the type of a key for storing in the Map.protected booleanvalidateValueForReading(org.datanucleus.state.DNStateManager sm, Object value) Utility to validate a value is ok for reading.protected voidvalidateValueForWriting(org.datanucleus.state.DNStateManager ownerSM, Object value) Utility to validate a value is ok for writing (present in the datastore).protected voidvalidateValueType(org.datanucleus.ClassLoaderResolver clr, Object value) Utility to validate the type of a value for storing in the Map.booleanAccessor for whether the values are embedded or not.booleanAccessor for whether the values are serialised or not.Methods inherited from class BaseContainerStore
allowsBatching, getComponentInformationForClass, getDatastoreAdapter, getOwnerMapping, getOwnerMemberMetaData, getRelationType, getStateManagerForEmbeddedPCObject, getStoreManager, isEmbeddedMapping, setOwnerMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.datanucleus.store.types.scostore.MapStore
clear, entrySetStore, keySetStore, put, put, putAll, remove, remove, update, updateEmbeddedKey, updateEmbeddedValue, valueCollectionStoreMethods 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
-
keysAreSerialised
-
valuesAreEmbedded
-
valuesAreSerialised
-
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.
-