Class AbstractArrayStore<E>
- java.lang.Object
-
- org.datanucleus.store.rdbms.scostore.BaseContainerStore
-
- org.datanucleus.store.rdbms.scostore.ElementContainerStore
-
- org.datanucleus.store.rdbms.scostore.AbstractArrayStore<E>
-
- Type Parameters:
E
- Type of element in this array
- All Implemented Interfaces:
org.datanucleus.store.types.scostore.ArrayStore<E>
,org.datanucleus.store.types.scostore.Store
- Direct Known Subclasses:
FKArrayStore
,JoinArrayStore
public abstract class AbstractArrayStore<E> extends ElementContainerStore implements org.datanucleus.store.types.scostore.ArrayStore<E>
Abstract representation of the backing store for an array.
-
-
Field Summary
-
Fields inherited from class org.datanucleus.store.rdbms.scostore.ElementContainerStore
addStmt, clearStmt, containerTable, elementCmd, elementInfo, elementIsPersistentInterface, elementMapping, elementsAreEmbedded, elementsAreSerialised, elementType, iterateUsingDiscriminator, orderMapping, relationDiscriminatorMapping, relationDiscriminatorValue, removeStmt, sizeStmt
-
Fields inherited from class org.datanucleus.store.rdbms.scostore.BaseContainerStore
allowNulls, clr, dba, ownerMapping, ownerMemberMetaData, relationType, storeMgr
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractArrayStore(RDBMSStoreManager storeMgr, org.datanucleus.ClassLoaderResolver clr)
Constructor.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description boolean
add(org.datanucleus.state.DNStateManager sm, E element, int position)
Adds one element to the association owner vs elementsvoid
clear(org.datanucleus.state.DNStateManager sm)
Clear the association from owner to all elements.void
clearInternal(org.datanucleus.state.DNStateManager ownerSM)
List<E>
getArray(org.datanucleus.state.DNStateManager sm)
Accessor for the array from the datastore.int[]
internalAdd(org.datanucleus.state.DNStateManager sm, E element, org.datanucleus.store.connection.ManagedConnection conn, boolean batched, int orderId, boolean executeNow)
Internal method to add a row to the join table.abstract Iterator<E>
iterator(org.datanucleus.state.DNStateManager ownerSM)
Accessor for an iterator through the array elements.boolean
set(org.datanucleus.state.DNStateManager sm, Object array)
Method to set the array for the specified owner to the passed value.-
Methods inherited from class org.datanucleus.store.rdbms.scostore.ElementContainerStore
getAddStmtForJoinTable, getClearStmt, getComponentInfoForElement, getContainerTable, getElementClassMetaData, getElementMapping, getRelationDiscriminatorMapping, getRelationDiscriminatorValue, getSize, getSizeStmt, hasOrderMapping, invalidateAddStmt, isElementsAreEmbedded, isElementsAreSerialised, size, usingJoinTable, validateElementForReading, validateElementForWriting, validateElementType
-
Methods inherited from class org.datanucleus.store.rdbms.scostore.BaseContainerStore
allowsBatching, getComponentInformationForClass, getDatastoreAdapter, getOwnerMapping, getOwnerMemberMetaData, getRelationType, getStateManagerForEmbeddedPCObject, getStoreManager, isEmbeddedMapping, setOwner
-
-
-
-
Constructor Detail
-
AbstractArrayStore
protected AbstractArrayStore(RDBMSStoreManager storeMgr, org.datanucleus.ClassLoaderResolver clr)
Constructor.- Parameters:
storeMgr
- Manager for the storeclr
- ClassLoader resolver
-
-
Method Detail
-
getArray
public List<E> getArray(org.datanucleus.state.DNStateManager sm)
Accessor for the array from the datastore.- Specified by:
getArray
in interfaceorg.datanucleus.store.types.scostore.ArrayStore<E>
- Parameters:
sm
- SM for the owner- Returns:
- The array (as a List of objects)
-
clear
public void clear(org.datanucleus.state.DNStateManager sm)
Clear the association from owner to all elements. Observes the necessary dependent field settings with respect to whether it should delete the element when doing so.- Specified by:
clear
in interfaceorg.datanucleus.store.types.scostore.ArrayStore<E>
- Overrides:
clear
in classElementContainerStore
- Parameters:
sm
- StateManager for the container.
-
set
public boolean set(org.datanucleus.state.DNStateManager sm, Object array)
Method to set the array for the specified owner to the passed value.- Specified by:
set
in interfaceorg.datanucleus.store.types.scostore.ArrayStore<E>
- Parameters:
sm
- StateManager for the ownerarray
- the array- Returns:
- Whether the array was updated successfully
-
add
public boolean add(org.datanucleus.state.DNStateManager sm, E element, int position)
Adds one element to the association owner vs elements- Parameters:
sm
- StateManager for the containerelement
- The element to addposition
- The position to add this element at- Returns:
- Whether it was successful
-
iterator
public abstract Iterator<E> iterator(org.datanucleus.state.DNStateManager ownerSM)
Accessor for an iterator through the array elements.- Specified by:
iterator
in interfaceorg.datanucleus.store.types.scostore.ArrayStore<E>
- Specified by:
iterator
in classElementContainerStore
- Parameters:
ownerSM
- StateManager for the container.- Returns:
- The Iterator
-
clearInternal
public void clearInternal(org.datanucleus.state.DNStateManager ownerSM)
-
internalAdd
public int[] internalAdd(org.datanucleus.state.DNStateManager sm, E element, org.datanucleus.store.connection.ManagedConnection conn, boolean batched, int orderId, boolean executeNow)
Internal method to add a row to the join table. Used by add() and set() to add a row to the join table.- Parameters:
sm
- StateManager for the owner of the collectionelement
- The element to add the relation toconn
- The connectionbatched
- Whether we are batchingorderId
- The order id to use for this element relationexecuteNow
- Whether to execute the statement now (and not wait for any batch)- Returns:
- Whether a row was inserted
-
-