Interface CollectionLoader<E>

All Superinterfaces:
BaseCollectionLoader, DataLoader
All Known Implementing Classes:
CollectionLoaderImpl

@InstallSubject("loadDelegate") public interface CollectionLoader<E> extends BaseCollectionLoader
Loader of entity collections.
  • Method Details

    • getContainer

      CollectionContainer<E> getContainer()
      Returns the container which accepts loaded entities.
      Specified by:
      getContainer in interface BaseCollectionLoader
      Specified by:
      getContainer in interface DataLoader
    • setContainer

      void setContainer(CollectionContainer<E> container)
      Sets the container which accepts loaded entities.
    • createLoadContext

      LoadContext<E> createLoadContext()
      Returns LoadContext which is created by the parameters of this loader. The LoadContext can be used with DataManager to load data by the same conditions.
    • isCacheable

      boolean isCacheable()
      Returns true if the query for loading data is cacheable.
    • setCacheable

      void setCacheable(boolean cacheable)
      Sets the query for loading data cacheable.
    • getFetchPlan

      FetchPlan getFetchPlan()
      Returns the fetch plan used for loading entities.
    • setFetchPlan

      void setFetchPlan(FetchPlan fetchPlan)
      Sets the fetch plan to use for loading entities.
    • setFetchPlan

      void setFetchPlan(String fetchPlanName)
      Sets the name of the fetch plan to use for loading entities.
      Throws:
      IllegalStateException - if the fetch plan has already been set by setFetchPlan(FetchPlan)
    • getLoadDelegate

      Function<LoadContext<E>,List<E>> getLoadDelegate()
      Returns a function which will be used to load data instead of standard implementation.
    • setLoadDelegate

      void setLoadDelegate(Function<LoadContext<E>,List<E>> delegate)
      Sets a function which will be used to load data instead of standard implementation.
    • addPreLoadListener

      Subscription addPreLoadListener(Consumer<CollectionLoader.PreLoadEvent<E>> listener)
      Adds a listener to CollectionLoader.PreLoadEvent.

      You can also add an event listener declaratively using a controller method annotated with Subscribe:

          @Subscribe(id = "fooDl", target = Target.DATA_LOADER)
           private void onFooDlPreLoad(CollectionLoader.PreLoadEvent event) {
               // handle event here
           }
       
      Parameters:
      listener - listener
      Returns:
      subscription
    • addPostLoadListener

      Subscription addPostLoadListener(Consumer<CollectionLoader.PostLoadEvent<E>> listener)
      Adds a listener to CollectionLoader.PostLoadEvent.

      You can also add an event listener declaratively using a controller method annotated with Subscribe:

          @Subscribe(id = "fooDl", target = Target.DATA_LOADER)
           private void onFooDlPostLoad(CollectionLoader.PostLoadEvent event) {
               // handle event here
           }
       
      Parameters:
      listener - listener
      Returns:
      subscription