Class DatabaseInfLoadQuery<T extends DatabaseInstance<T>>

java.lang.Object
com.syzygy.events.database.DatabaseInfLoadQuery<T>
Type Parameters:
T - The type of instance being returned
All Implemented Interfaces:
Database.Dissolvable, Database.Querrier<DatabaseInfLoadQuery<T>>, Database.UpdateListener

@Dissolves public class DatabaseInfLoadQuery<T extends DatabaseInstance<T>> extends Object implements Database.UpdateListener, Database.Querrier<DatabaseInfLoadQuery<T>>, Database.Dissolvable
Stores a query that is executed on a collection within the database. Loads instances returned from this query by pages compounding
Since:
21oct24
See Also:
  • Field Details

    • query

      @NonNull private final DatabaseQuery<T extends DatabaseInstance<T>> query
      The database query object
    • outOfDate

      private boolean outOfDate
      If an item from the current set of instances has been deleted or updated
    • instances

      private final List<T extends DatabaseInstance<T>> instances
      The set of instances
  • Constructor Details

  • Method Details

    • refreshData

      @Titrates(what="Result Instances", when="All success") @StirsDeep(what="Previous Instances", when="All success") public void refreshData(Database.Querrier.Listener<DatabaseInfLoadQuery<T>> listener)
      Resets all data and loads the first page of data of this query and loads the new instances
      Specified by:
      refreshData in interface Database.Querrier<T extends DatabaseInstance<T>>
      Parameters:
      listener - The listener that will be called on completion
    • incrementData

      @Titrates(what="Result Instances", when="All success") public void incrementData(Database.Querrier.Listener<DatabaseInfLoadQuery<T>> listener)
      Adds a page of data to the current list and loads the instances
      Parameters:
      listener - The listener that will called on completion.
    • isOutOfDate

      public boolean isOutOfDate()
      If an item from the current set of instances has been deleted or updated
      Returns:
      true if an item has been deleted or updated
    • dissolve

      @AutoStir public void dissolve()
      Removes references to all instances that have been created and clears the current instance
      Specified by:
      dissolve in interface Database.Dissolvable
    • hasUnloadedData

      public boolean hasUnloadedData()
      Returns true if there is more data to load (to the knowledge of this list)

      If the last result returned a full page, this assumes there is more to load

      Returns:
      true if there is more data to load
    • getInstances

      @NonNull @Observes public @Unmodifiable List<T> getInstances()
      Returns:
      An unmodifiable list of the current instances loaded
    • methods

      Returns an object which contains methods that help notify the user or change the status of the associations. This object must be called with .dissolve once complete
      Parameters:
      query - The query containing the associations
      Returns:
      The set of methods for the associations currently in the list (does not match on change)
    • clearInstances

      @StirsDeep(what="Results") private void clearInstances()
      Clears the set of instances
    • addAllInstances

      @Titrates(what="All instances") private void addAllInstances()
      Adds all the instances in the current page to this set
    • onUpdate

      public <S extends DatabaseInstance<S>> void onUpdate(DatabaseInstance<S> instance, Database.UpdateListener.Type type)
      Specified by:
      onUpdate in interface Database.UpdateListener