org.datanucleus.store.mapped.scostore
Class MapEntrySetStore

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

public abstract class MapEntrySetStore
extends BaseContainerStore
implements SetStore

Representation of backing store for a Map EntrySet.


Field Summary
protected  ClassLoaderResolver clr
           
protected  JavaTypeMapping keyMapping
          Mapping for the key.
protected  MapStore mapStore
          The backing store for the Map.
protected  DatastoreContainerObject mapTable
          Table containing the key and value forming the entry.
protected  JavaTypeMapping valueMapping
          Mapping for the value.
 
Fields inherited from class org.datanucleus.store.mapped.scostore.BaseContainerStore
allowNulls, dba, LOCALISER, ownerMapping, ownerMemberMetaData, relationType, storeMgr
 
Constructor Summary
MapEntrySetStore(DatastoreContainerObject mapTable, AbstractMemberMetaData ownerMemberMetaData, JavaTypeMapping ownerMapping, JavaTypeMapping keyMapping, JavaTypeMapping valueMapping, MapStore mapStore, ClassLoaderResolver clr)
          Constructor for a store for the entries of a map.
 
Method Summary
 boolean add(ObjectProvider sm, java.lang.Object element, int size)
          Method to add an entry to the Map.
 boolean addAll(ObjectProvider sm, java.util.Collection elements, int size)
          Method to add entries to the Map.
 void clear(ObjectProvider sm)
          Method to clear the Map.
 boolean contains(ObjectProvider sm, java.lang.Object element)
          Method to check if an element exists in the collection.
 JavaTypeMapping getKeyMapping()
           
 MapStore getMapStore()
           
 JavaTypeMapping getOwnerMapping()
          Accessor for the owner mapping.
 JavaTypeMapping getValueMapping()
           
 boolean hasOrderMapping()
          Accessor for whether this store has an order mapping to allow for duplicates, or ordering.
abstract  java.util.Iterator iterator(ObjectProvider sm)
          Accessor for an iterator for the entries of the Map.
 boolean remove(ObjectProvider sm, java.lang.Object element, int size, boolean allowDependentField)
          Method to remove an entry from the Map.
 boolean removeAll(ObjectProvider sm, java.util.Collection elements, int size)
          Method to remove entries from the Map.
abstract  int size(ObjectProvider sm)
          Accessor for the size of the Map.
 void update(ObjectProvider sm, java.util.Collection coll)
          Method to update the collection to be the supplied collection of elements.
 boolean updateEmbeddedElement(ObjectProvider sm, java.lang.Object element, int fieldNumber, java.lang.Object value)
          Method to update an embedded element.
protected  boolean validateElementType(java.lang.Object element)
           
 
Methods inherited from class org.datanucleus.store.mapped.scostore.BaseContainerStore
allowsBatching, getDatastoreAdapter, 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
getElementType
 
Methods inherited from interface org.datanucleus.store.scostore.Store
getStoreManager
 

Field Detail

mapTable

protected DatastoreContainerObject mapTable
Table containing the key and value forming the entry.


mapStore

protected MapStore mapStore
The backing store for the Map.


keyMapping

protected JavaTypeMapping keyMapping
Mapping for the key.


valueMapping

protected JavaTypeMapping valueMapping
Mapping for the value.


clr

protected ClassLoaderResolver clr
Constructor Detail

MapEntrySetStore

public MapEntrySetStore(DatastoreContainerObject mapTable,
                        AbstractMemberMetaData ownerMemberMetaData,
                        JavaTypeMapping ownerMapping,
                        JavaTypeMapping keyMapping,
                        JavaTypeMapping valueMapping,
                        MapStore mapStore,
                        ClassLoaderResolver clr)
Constructor for a store for the entries of a map.

Parameters:
mapTable - The table handling the relation (can be join table, or key table, or value table)
ownerMemberMetaData - Metadata for the owning field/property
ownerMapping - Mapping back to the owner from this table
keyMapping - Mapping for the key
valueMapping - Mapping for the value
mapStore - Backing store for the map
clr - ClassLoader resolver
Method Detail

hasOrderMapping

public boolean hasOrderMapping()
Accessor for whether this store has an order mapping to allow for duplicates, or ordering.

Specified by:
hasOrderMapping in interface CollectionStore
Returns:
Whether it has an order mapping.

updateEmbeddedElement

public boolean updateEmbeddedElement(ObjectProvider sm,
                                     java.lang.Object element,
                                     int fieldNumber,
                                     java.lang.Object value)
Method to update an embedded element.

Specified by:
updateEmbeddedElement in interface CollectionStore
Parameters:
sm - State Manager of the owner
element - The element to update
fieldNumber - The number of the field to update
value - The value
Returns:
Whether the element was modified

getOwnerMapping

public JavaTypeMapping getOwnerMapping()
Accessor for the owner mapping.

Overrides:
getOwnerMapping in class BaseContainerStore
Returns:
The owner mapping

validateElementType

protected boolean validateElementType(java.lang.Object element)

iterator

public abstract java.util.Iterator iterator(ObjectProvider sm)
Accessor for an iterator for the entries of the Map. Implemented by the subclass using whatever querying mechanism is suitable for the underlying datastore.

Specified by:
iterator in interface CollectionStore
Parameters:
sm - State manager for the owner
Returns:
The iterator

size

public abstract int size(ObjectProvider sm)
Accessor for the size of the Map.

Specified by:
size in interface CollectionStore
Parameters:
sm - The state manager
Returns:
The size

update

public void update(ObjectProvider sm,
                   java.util.Collection coll)
Method to update the collection to be the supplied collection of elements.

Specified by:
update in interface CollectionStore
Parameters:
sm - StateManager of the object
coll - The collection to use

contains

public boolean contains(ObjectProvider sm,
                        java.lang.Object element)
Description copied from interface: CollectionStore
Method to check if an element exists in the collection.

Specified by:
contains in interface CollectionStore
Parameters:
sm - State Manager for the collection.
element - Element to check
Returns:
Whether the element exists in the collection.

add

public boolean add(ObjectProvider sm,
                   java.lang.Object element,
                   int size)
Method to add an entry to the Map.

Specified by:
add in interface CollectionStore
Parameters:
sm - State Manager for the owner
element - Entry to add
size - Current size of the collection if known. -1 if not known
Returns:
Whether it was added

addAll

public boolean addAll(ObjectProvider sm,
                      java.util.Collection elements,
                      int size)
Method to add entries to the Map.

Specified by:
addAll in interface CollectionStore
Parameters:
sm - State Manager for the owner
elements - Entries to add
size - Current size of collection (if known). -1 if not known
Returns:
Whether they were added

remove

public boolean remove(ObjectProvider sm,
                      java.lang.Object element,
                      int size,
                      boolean allowDependentField)
Method to remove an entry from the Map.

Specified by:
remove in interface CollectionStore
Parameters:
sm - State Manager for the owner
element - Entry to remove
size - Current size of collection if known. -1 if not known
allowDependentField - Whether to allow any cascading delete actions to be fired from this removal
Returns:
Whether it was removed

removeAll

public boolean removeAll(ObjectProvider sm,
                         java.util.Collection elements,
                         int size)
Method to remove entries from the Map.

Specified by:
removeAll in interface CollectionStore
Parameters:
sm - State Manager for the owner
elements - Entries to remove
size - Current size of collection if known. -1 if not known
Returns:
Whether they were removed

clear

public void clear(ObjectProvider sm)
Method to clear the Map.

Specified by:
clear in interface CollectionStore
Parameters:
sm - State Manager for the owner.

getMapStore

public MapStore getMapStore()

getKeyMapping

public JavaTypeMapping getKeyMapping()

getValueMapping

public JavaTypeMapping getValueMapping()


Copyright © 2011. All Rights Reserved.