Module io.ebean.api

Class BeanList<E>

    • Field Detail

      • readOnly

        protected boolean readOnly
      • disableLazyLoad

        protected boolean disableLazyLoad
      • loader

        protected transient BeanCollectionLoader loader
        The Database this is associated with. (used for lazy fetch).
      • registeredWithLoadContext

        protected boolean registeredWithLoadContext
        Flag set when registered with the batch loading context.
      • ebeanServerName

        protected String ebeanServerName
      • ownerBean

        protected EntityBean ownerBean
        The owning bean (used for lazy fetch).
      • propertyName

        protected String propertyName
        The name of this property in the owning bean (used for lazy fetch).
      • modifyHolder

        protected io.ebean.common.ModifyHolder<E> modifyHolder
      • modifyListening

        protected boolean modifyListening
    • Constructor Detail

      • BeanList

        public BeanList​(List<E> list)
        Specify the underlying List implementation.
      • BeanList

        public BeanList()
        Uses an ArrayList as the underlying List implementation.
    • Method Detail

      • reset

        public void reset​(EntityBean ownerBean,
                          String propertyName)
        Description copied from interface: BeanCollection
        Reset the collection back to an empty state ready for reloading.

        This is done as part of bean refresh.

        Specified by:
        reset in interface BeanCollection<E>
      • isSkipSave

        public boolean isSkipSave()
        Description copied from interface: BeanCollection
        Return true if the collection is uninitialised or is empty without any held modifications.

        Returning true means can safely skip cascade save for this bean collection.

        Specified by:
        isSkipSave in interface BeanCollection<E>
      • internalAdd

        public void internalAdd​(Object bean)
        Description copied from interface: BeanCollection
        Add the bean to the collection. This is disallowed for BeanMap.
        Specified by:
        internalAdd in interface BeanCollection<E>
      • checkEmptyLazyLoad

        public boolean checkEmptyLazyLoad()
        Description copied from interface: BeanCollection
        Check after the lazy load that the underlying collection is not null (handle case where join to many not outer).

        That is, if the collection was not loaded due to filterMany predicates etc then make sure the collection is set to empty.

        Specified by:
        checkEmptyLazyLoad in interface BeanCollection<E>
      • setActualList

        public void setActualList​(List<?> list)
        Set the actual underlying list.

        This is primarily for the deferred fetching function.

      • getActualList

        public List<E> getActualList()
        Return the actual underlying list.
      • getActualEntries

        public Collection<?> getActualEntries()
        Description copied from interface: BeanCollection
        Returns the underlying entries so for Maps this is a collection of Map.Entry.

        For maps this returns the entrySet as we need the keys of the map.

        Specified by:
        getActualEntries in interface BeanCollection<E>
      • isPopulated

        public boolean isPopulated()
        Return true if the underlying list is populated.
        Specified by:
        isPopulated in interface BeanCollection<E>
      • isReference

        public boolean isReference()
        Return true if this is a reference (lazy loading) bean collection. This is the same as !isPopulated();
        Specified by:
        isReference in interface BeanCollection<E>
      • equals

        public boolean equals​(Object other)
        Equal if obj is a List and equal in a list sense.

        Specifically obj does not need to be a BeanList but any list. This does not use the FindMany, fetchedMaxRows or finishedFetch properties in the equals test.

        Specified by:
        equals in interface Collection<E>
        Specified by:
        equals in interface List<E>
        Overrides:
        equals in class Object
      • add

        public void add​(int index,
                        E element)
        Specified by:
        add in interface List<E>
      • addBean

        public void addBean​(E bean)
        Description copied from interface: BeanCollection
        Add a bean to the list/set with modifyListen notification.
        Specified by:
        addBean in interface BeanCollection<E>
      • add

        public boolean add​(E bean)
        Specified by:
        add in interface Collection<E>
        Specified by:
        add in interface List<E>
      • addAll

        public boolean addAll​(int index,
                              Collection<? extends E> beans)
        Specified by:
        addAll in interface List<E>
      • get

        public E get​(int index)
        Specified by:
        get in interface List<E>
      • indexOf

        public int indexOf​(Object bean)
        Specified by:
        indexOf in interface List<E>
      • removeBean

        public void removeBean​(E bean)
        Description copied from interface: BeanCollection
        Remove a bean to the list/set with modifyListen notification.
        Specified by:
        removeBean in interface BeanCollection<E>
      • remove

        public E remove​(int index)
        Specified by:
        remove in interface List<E>
      • set

        public E set​(int index,
                     E element)
        Specified by:
        set in interface List<E>
      • subList

        public List<E> subList​(int fromIndex,
                               int toIndex)
        Specified by:
        subList in interface List<E>
      • getFilterMany

        public ExpressionList<?> getFilterMany()
        Description copied from interface: BeanCollection
        Return the filter (if any) that was used in building this collection.

        This is so that the filter can be applied on refresh.

        Specified by:
        getFilterMany in interface BeanCollection<E>
      • setDisableLazyLoad

        public void setDisableLazyLoad​(boolean disableLazyLoad)
        Description copied from interface: BeanCollection
        Set the disableLazyLoad state.
        Specified by:
        setDisableLazyLoad in interface BeanCollection<E>
      • isRegisteredWithLoadContext

        public boolean isRegisteredWithLoadContext()
        Description copied from interface: BeanCollection
        Return true if the collection has been registered with the batch loading context.
        Specified by:
        isRegisteredWithLoadContext in interface BeanCollection<E>
      • setLoader

        public void setLoader​(BeanCollectionLoader loader)
        Description copied from interface: BeanCollection
        Set the loader that will be used to lazy/query load this collection.

        This is effectively the batch loading context this collection is registered with.

        Specified by:
        setLoader in interface BeanCollection<E>
      • isReadOnly

        public boolean isReadOnly()
        Description copied from interface: BeanCollection
        Return true if the collection should be treated as readOnly and no elements can be added or removed etc.
        Specified by:
        isReadOnly in interface BeanCollection<E>
      • setReadOnly

        public void setReadOnly​(boolean readOnly)
        Description copied from interface: BeanCollection
        Set to true if you want the BeanCollection to be treated as read only. This means no elements can be added or removed etc.
        Specified by:
        setReadOnly in interface BeanCollection<E>
      • hasModifications

        public boolean hasModifications()
        Description copied from interface: BeanCollection
        Return true if the collection is modify listening and has modifications.
        Specified by:
        hasModifications in interface BeanCollection<E>
      • modifyAddition

        public void modifyAddition​(E bean)
        Description copied from interface: BeanCollection
        Add an object to the additions list.

        This will potentially end up as an insert into a intersection table for a ManyToMany.

        Specified by:
        modifyAddition in interface BeanCollection<E>
      • modifyRemoval

        public void modifyRemoval​(Object bean)
        Description copied from interface: BeanCollection
        Add an object to the deletions list.

        This will potentially end up as an delete from an intersection table for a ManyToMany.

        Specified by:
        modifyRemoval in interface BeanCollection<E>
      • modifyReset

        public void modifyReset()
        Description copied from interface: BeanCollection
        Reset the set of additions and deletions. This is called after the additions and removals have been processed.
        Specified by:
        modifyReset in interface BeanCollection<E>
      • getModifyAdditions

        public Set<E> getModifyAdditions()
        Description copied from interface: BeanCollection
        Return the list of objects added to the list set or map. These will used to insert rows into the intersection table of a ManyToMany.
        Specified by:
        getModifyAdditions in interface BeanCollection<E>
      • getModifyRemovals

        public Set<E> getModifyRemovals()
        Description copied from interface: BeanCollection
        Return the list of objects removed from the list set or map. These will used to delete rows from the intersection table of a ManyToMany.
        Specified by:
        getModifyRemovals in interface BeanCollection<E>
      • holdsModifications

        public boolean holdsModifications()
        Return true if there are underlying additions or removals.
        Specified by:
        holdsModifications in interface BeanCollection<E>
      • wasTouched

        public boolean wasTouched()
        Description copied from interface: BeanCollection
        Has been modified by an addition or removal.
        Specified by:
        wasTouched in interface BeanCollection<E>
      • setFromOriginal

        protected void setFromOriginal​(io.ebean.common.AbstractBeanCollection<E> other)
        Copies all relevant properties for a clone. See BeanCollection.getShallowCopy()