Class 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.
    • Constructor Detail

      • AbstractArrayStore

        protected AbstractArrayStore​(RDBMSStoreManager storeMgr,
                                     org.datanucleus.ClassLoaderResolver clr)
        Constructor.
        Parameters:
        storeMgr - Manager for the store
        clr - 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 interface org.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 interface org.datanucleus.store.types.scostore.ArrayStore<E>
        Overrides:
        clear in class ElementContainerStore
        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 interface org.datanucleus.store.types.scostore.ArrayStore<E>
        Parameters:
        sm - StateManager for the owner
        array - 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 container
        element - The element to add
        position - 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 interface org.datanucleus.store.types.scostore.ArrayStore<E>
        Specified by:
        iterator in class ElementContainerStore
        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 collection
        element - The element to add the relation to
        conn - The connection
        batched - Whether we are batching
        orderId - The order id to use for this element relation
        executeNow - Whether to execute the statement now (and not wait for any batch)
        Returns:
        Whether a row was inserted