Class Page<T>

java.lang.Object
com.mxraven.admin.Page<T>

public final class Page<T> extends Object
One page of a v2 cursor-paginated collection.

Most callers never touch this type: Paged hides pagination behind iteration. This is the low-level escape hatch, reached through Paged.firstPage(), for callers that want to walk pages deliberately. A page returned from a list(...) call can fetch its neighbours:


 Page<Domain> first = ws.domains().list().firstPage();
 Page<Domain> second = first.nextPage();
 Page<Domain> back = second.previousPage();
 

Tokens are opaque. Never parse, construct, or persist them as durable resource identifiers.

  • Method Details

    • items

      public List<T> items()
      Items on this page.
      Returns:
      an immutable list of the items on this page
    • nextPageToken

      public String nextPageToken()
      Returns the opaque token for the next page, when one exists.
      Returns:
      the next page token, or null when there is no next page
    • previousPageToken

      public String previousPageToken()
      Returns the opaque token for the previous page, when one exists.
      Returns:
      the previous page token, or null when there is no previous page
    • lastPageToken

      public String lastPageToken()
      Returns the opaque token for the last page, when known.
      Returns:
      the last page token, or null when unavailable
    • hasNext

      public boolean hasNext()
      Returns whether a next page is available.
      Returns:
      true if nextPageToken() is present
    • hasPrevious

      public boolean hasPrevious()
      Returns whether a previous page is available.
      Returns:
      true if previousPageToken() is present
    • nextPage

      public Page<T> nextPage()
      Fetch the next page.
      Returns:
      the next page
      Throws:
      IllegalStateException - if there is no next page, or this page came from a source that cannot fetch pages
    • previousPage

      public Page<T> previousPage()
      Fetch the previous page.
      Returns:
      the previous page
      Throws:
      IllegalStateException - if there is no previous page, or this page came from a source that cannot fetch pages
    • map

      public <R> Page<R> map(Function<? super T,? extends R> mapper)
      Transform every item on this page, preserving its pagination tokens.
      Type Parameters:
      R - mapped element type
      Parameters:
      mapper - function applied to each item
      Returns:
      a new page with mapped items and the same tokens, without a fetcher
    • toString

      public String toString()
      Overrides:
      toString in class Object