Class CursorPage<O>

java.lang.Object
java.util.AbstractCollection<O>
java.util.AbstractList<O>
ubic.gemma.persistence.util.CursorPage<O>
All Implemented Interfaces:
Iterable<O>, Collection<O>, List<O>, SequencedCollection<O>

public class CursorPage<O> extends AbstractList<O> implements List<O>
A page of results returned by keyset (cursor) pagination. Parallels Slice.

Unlike Slice, a CursorPage carries no offset and the totalElements count is optional (and null by default — cursor mode avoids the COUNT(*) cost of computing a total on every request). The page carries nextCursor / prevCursor tokens (also nullable) for the client to use as the ?cursor= parameter on the following request.

Author:
phase3
  • Constructor Details

    • CursorPage

      public CursorPage(List<O> data, @Nullable Sort sort, @Nullable Integer limit, @Nullable String nextCursor, @Nullable String prevCursor, @Nullable Long totalElements)
  • Method Details

    • get

      public O get(int i)
      Specified by:
      get in interface List<O>
      Specified by:
      get in class AbstractList<O>
    • size

      public int size()
      Specified by:
      size in interface Collection<O>
      Specified by:
      size in interface List<O>
      Specified by:
      size in class AbstractCollection<O>
    • getSort

      @Nullable public Sort getSort()
    • getLimit

      @Nullable public Integer getLimit()
    • getNextCursor

      @Nullable public String getNextCursor()
      Returns:
      base64url-encoded cursor token for the next page, or null if this is the last page.
    • getPrevCursor

      @Nullable public String getPrevCursor()
      Returns:
      base64url-encoded cursor token for the previous page, or null if this is the first page (or if backward navigation is not supported by the producing DAO).
    • getTotalElements

      @Nullable public Long getTotalElements()
      Returns:
      total element count, or null when not computed. Cursor pagination intentionally omits this by default to avoid COUNT(*) per request; clients that need it can opt in via the endpoint's ?includeTotal=true parameter when available.
    • map

      public <S> CursorPage<S> map(Function<? super O, ? extends S> converter)