Interface DataRetrievalWatcherListener<T>

  • Type Parameters:
    T - The type of elements in the data collection.

    public interface DataRetrievalWatcherListener<T>
    Listener interface to be notified of progress in the operation of retrieving the elements of a data collection being watched by a DataRetrievalWatcher object.
    • Method Detail

      • onRetrievalProgress

        void onRetrievalProgress​(DataRetrievalWatcher<T> watcher,
                                 boolean determinate,
                                 int numRetrieved,
                                 int total)
        Called to report progress in loading elements into the data collection.

        This is called after new elements have been added to the data collection.

        Parameters:
        watcher - The data retrieval watcher object that is reporting progress.
        determinate - If true, the total number of elements to be loaded is known in advance. If false, the total number of elements is not known, and the retrieval will continue until it runs out of data.
        numRetrieved - The number of elements that has been retrieved so far.
        total - The total number of elements. This can only be relied upon when determinate is true.
      • onRetrievalCompleted

        void onRetrievalCompleted​(DataRetrievalWatcher<T> watcher)
        Called when the retrieval operation has completed.
        Parameters:
        watcher - The data retrieval watcher object whose retrieval operation has completed.
      • onRetrievalFailed

        void onRetrievalFailed​(DataRetrievalWatcher<T> watcher,
                               java.lang.Exception failure)
        Called when the retrieval operation has failed.

        If this is called, there will be no further updates to the data retrieval and data collection. Any existing data in the data collection that was already received is still accessible and might still be of use.

        Parameters:
        watcher - The data retrieval watcher object whose retrieval operation has failed.
        failure - Object containing information about the failure.
      • onCollectionChanged

        void onCollectionChanged​(DataRetrievalWatcher<T> watcher,
                                 DataCollectionChangeType changeType,
                                 java.util.List<T> changedItems)
        Called whenever the underlying data collection has changed.
        Parameters:
        watcher - The data retrieval watcher object whose watched data collection has changed.
        changeType - Indicates the type of change that occurred on the data collection.
        changedItems - The list of elements that have changed. Note that for a change type of COLLECTION_CLEARED this list will be empty.