Class ListBackedPagingResults<R>

  • All Implemented Interfaces:
    PagingResults<R>

    public class ListBackedPagingResults<R>
    extends Object
    implements PagingResults<R>
    Wraps a list of items as a PagingResults, used typically when migrating from a full listing system to a paged one.
    Since:
    Odin
    Author:
    Nick Burch
    • Constructor Detail

      • ListBackedPagingResults

        public ListBackedPagingResults​(List<R> list)
      • ListBackedPagingResults

        public ListBackedPagingResults​(List<R> list,
                                       PagingRequest paging)
    • Method Detail

      • getPage

        public List<R> getPage()
        Returns the whole set of results as one page
        Specified by:
        getPage in interface PagingResults<R>
        Returns:
        the results - possibly empty but never null
      • hasMoreItems

        public boolean hasMoreItems()
        Description copied from interface: PagingResults
        True if more items on next page.

        Note: could also return true if page was cutoff/trimmed for some reason (eg. due to permission checks of large page of requested max items)

        Specified by:
        hasMoreItems in interface PagingResults<R>
        Returns:
        true if more items (eg. on next page)
        - true => at least one more page (or incomplete page - if cutoff)
        - false => last page (or incomplete page - if cutoff)
      • getTotalResultCount

        public Pair<Integer,​Integer> getTotalResultCount()
        We know exactly how many results there are
        Specified by:
        getTotalResultCount in interface PagingResults<R>
        Returns:
        Returns the total results as a range (all results, including the paged results returned)
      • getQueryExecutionId

        public String getQueryExecutionId()
        There is no unique query ID, as no query was done
        Specified by:
        getQueryExecutionId in interface PagingResults<R>
        Returns:
        a unique ID associated with the query execution results