org.datanucleus.store.mapped.scostore
Class MapKeySetStore

java.lang.Object
  extended by org.datanucleus.store.mapped.scostore.BaseContainerStore
      extended by org.datanucleus.store.mapped.scostore.ElementContainerStore
          extended by org.datanucleus.store.mapped.scostore.AbstractCollectionStore
              extended by org.datanucleus.store.mapped.scostore.AbstractSetStore
                  extended by org.datanucleus.store.mapped.scostore.MapKeySetStore
All Implemented Interfaces:
CollectionStore, SetStore, Store

public abstract class MapKeySetStore
extends AbstractSetStore

Representation of the backing store for the keys of a Map. This is used where the user calls Map.keySet() and then wants to perform some operation on the resulting Set. The keys for a Map can be stored in several ways. There are the following possibilities


Nested Class Summary
 
Nested classes/interfaces inherited from class org.datanucleus.store.mapped.scostore.ElementContainerStore
ElementContainerStore.ElementInfo
 
Field Summary
protected  MapStore mapStore
           
 
Fields inherited from class org.datanucleus.store.mapped.scostore.ElementContainerStore
clr, containerTable, elementInfo, elementIsPersistentInterface, elementMapping, elementsAreEmbedded, elementsAreSerialised, elementType, emd, iterateUsingDiscriminator, orderMapping, relationDiscriminatorMapping, relationDiscriminatorValue, specialization
 
Fields inherited from class org.datanucleus.store.mapped.scostore.BaseContainerStore
allowNulls, dba, LOCALISER, ownerMapping, ownerMemberMetaData, relationType, storeMgr
 
Constructor Summary
MapKeySetStore(DatastoreContainerObject mapTable, AbstractMemberMetaData ownerMmd, JavaTypeMapping ownerMapping, JavaTypeMapping keyMapping, MapStore mapStore, ClassLoaderResolver clr, AbstractSetStoreSpecialization specialization)
          Constructor for a backing store for the keys of a map relation.
 
Method Summary
 boolean add(ObjectProvider sm, java.lang.Object element, int size)
          Method to add an element.
 boolean addAll(ObjectProvider sm, java.util.Collection elements, int size)
          Method to add a collection of elements.
protected abstract  boolean canClear()
           
protected abstract  boolean canRemove()
           
 void clear(ObjectProvider sm)
          Method to clear the collection.
 boolean remove(ObjectProvider sm, java.lang.Object element, int size, boolean allowDependentField)
          Method to remove an element.
 boolean removeAll(ObjectProvider sm, java.util.Collection elements, int size)
          Method to remove a collection of elements.
 
Methods inherited from class org.datanucleus.store.mapped.scostore.AbstractSetStore
iterator
 
Methods inherited from class org.datanucleus.store.mapped.scostore.AbstractCollectionStore
contains, update, updateEmbeddedElement
 
Methods inherited from class org.datanucleus.store.mapped.scostore.ElementContainerStore
getContainerTable, getElementInfo, getElementInformationForClass, getElementMapping, getElementType, getEmd, getOrderMapping, getRelationDiscriminatorMapping, getRelationDiscriminatorValue, hasOrderMapping, isElementsAreEmbedded, isElementsAreSerialised, size, validateElementForReading, validateElementForWriting, validateElementType
 
Methods inherited from class org.datanucleus.store.mapped.scostore.BaseContainerStore
allowsBatching, 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.scostore.CollectionStore
contains, getElementType, hasOrderMapping, size, update, updateEmbeddedElement
 
Methods inherited from interface org.datanucleus.store.scostore.Store
getStoreManager
 

Field Detail

mapStore

protected final MapStore mapStore
Constructor Detail

MapKeySetStore

public MapKeySetStore(DatastoreContainerObject mapTable,
                      AbstractMemberMetaData ownerMmd,
                      JavaTypeMapping ownerMapping,
                      JavaTypeMapping keyMapping,
                      MapStore mapStore,
                      ClassLoaderResolver clr,
                      AbstractSetStoreSpecialization specialization)
Constructor for a backing store for the keys of a map relation.

Parameters:
mapTable - The table for the map (table storing the map linkage)
ownerMmd - Metadata for the owner member
ownerMapping - mapping from the map table to the owner table
keyMapping - mapping from the map table to the key
mapStore - The backing store for the map
clr - The ClassLoaderResolver
specialization - The specialisation
Method Detail

add

public boolean add(ObjectProvider sm,
                   java.lang.Object element,
                   int size)
Method to add an element. Overridden because we want to prevent it.

Specified by:
add in interface CollectionStore
Overrides:
add in class AbstractSetStore
Parameters:
sm - State Manager of collection.
element - Element to add.
size - Current size of the collection if known. -1 if not known
Returns:
Whether it was successful

addAll

public boolean addAll(ObjectProvider sm,
                      java.util.Collection elements,
                      int size)
Method to add a collection of elements. Overridden because we want to prevent it.

Specified by:
addAll in interface CollectionStore
Overrides:
addAll in class AbstractSetStore
Parameters:
sm - State Manager of collection.
elements - Elements to add.
size - Current size of set (if known). Not used by sets
Returns:
Whether it was successful

remove

public boolean remove(ObjectProvider sm,
                      java.lang.Object element,
                      int size,
                      boolean allowDependentField)
Method to remove an element. Overridden because we want to prevent it.

Specified by:
remove in interface CollectionStore
Overrides:
remove in class AbstractSetStore
Parameters:
sm - State Manager of collection.
element - Element to remove.
size - Current size
allowDependentField - Whether to allow any cascade deletes caused by this removal
Returns:
Whether it was successful

removeAll

public boolean removeAll(ObjectProvider sm,
                         java.util.Collection elements,
                         int size)
Method to remove a collection of elements. Overridden because we want to prevent it.

Specified by:
removeAll in interface CollectionStore
Overrides:
removeAll in class AbstractSetStore
Parameters:
sm - State Manager of collection.
elements - Elements to remove.
size - Current size of collection if known. -1 if not known
Returns:
Whether it was successful

clear

public void clear(ObjectProvider sm)
Method to clear the collection. Overridden because we want to prevent it.

Specified by:
clear in interface CollectionStore
Overrides:
clear in class ElementContainerStore
Parameters:
sm - State Manager of collection.

canRemove

protected abstract boolean canRemove()

canClear

protected abstract boolean canClear()


Copyright © 2011. All Rights Reserved.