Class AbstractSetStore<E>

  • All Implemented Interfaces:
    org.datanucleus.store.types.scostore.CollectionStore<E>, org.datanucleus.store.types.scostore.SetStore<E>, org.datanucleus.store.types.scostore.Store
    Direct Known Subclasses:
    FKSetStore, JoinSetStore

    public abstract class AbstractSetStore<E>
    extends AbstractCollectionStore<E>
    implements org.datanucleus.store.types.scostore.SetStore<E>
    Abstract representation of the backing store for a Set/Collection. Can be used for a join table set, or a map key set.
    • Constructor Detail

      • AbstractSetStore

        protected AbstractSetStore​(RDBMSStoreManager storeMgr,
                                   org.datanucleus.ClassLoaderResolver clr)
        Constructor.
        Parameters:
        storeMgr - Manager for the store
        clr - The ClassLoaderResolver
    • Method Detail

      • iterator

        public abstract Iterator<E> iterator​(org.datanucleus.state.ObjectProvider op)
        Accessor for an iterator for the set. Implemented by the subclass using whatever mechanism the underlying datastore provides.
        Specified by:
        iterator in interface org.datanucleus.store.types.scostore.CollectionStore<E>
        Specified by:
        iterator in class ElementContainerStore
        Parameters:
        op - ObjectProvider for the set.
        Returns:
        Iterator for the set.
      • remove

        public boolean remove​(org.datanucleus.state.ObjectProvider op,
                              Object element,
                              int size,
                              boolean allowDependentField)
        Removes the association to one element
        Specified by:
        remove in interface org.datanucleus.store.types.scostore.CollectionStore<E>
        Parameters:
        op - ObjectProvider for the container
        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​(org.datanucleus.state.ObjectProvider op,
                                 Collection elements,
                                 int size)
        Remove all elements from a collection from the association owner vs elements. This implementation iterates around the remove() method doing each element 1 at a time. Please refer to the JoinSetStore and FKSetStore for the variations used there. This is used for Map key and value stores.
        Specified by:
        removeAll in interface org.datanucleus.store.types.scostore.CollectionStore<E>
        Parameters:
        op - ObjectProvider for the container
        elements - Collection of elements to remove
        Returns:
        Whether the database was updated