Package com.mxraven.admin
Class Page<T>
java.lang.Object
com.mxraven.admin.Page<T>
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 Summary
Modifier and TypeMethodDescriptionbooleanhasNext()Returns whether a next page is available.booleanReturns whether a previous page is available.items()Items on this page.Returns the opaque token for the last page, when known.<R> Page<R>Transform every item on this page, preserving its pagination tokens.nextPage()Fetch the next page.Returns the opaque token for the next page, when one exists.Fetch the previous page.Returns the opaque token for the previous page, when one exists.toString()
-
Method Details
-
items
Items on this page.- Returns:
- an immutable list of the items on this page
-
nextPageToken
Returns the opaque token for the next page, when one exists.- Returns:
- the next page token, or
nullwhen there is no next page
-
previousPageToken
Returns the opaque token for the previous page, when one exists.- Returns:
- the previous page token, or
nullwhen there is no previous page
-
lastPageToken
Returns the opaque token for the last page, when known.- Returns:
- the last page token, or
nullwhen unavailable
-
hasNext
public boolean hasNext()Returns whether a next page is available.- Returns:
trueifnextPageToken()is present
-
hasPrevious
public boolean hasPrevious()Returns whether a previous page is available.- Returns:
trueifpreviousPageToken()is present
-
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
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
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
-