Annotation Type Paginated
Page<T>, instead of leaving the fetch-extract-repeat loop to
hand-written code. See docs/design/pagination-helper.md for the
full design, every default, and the exhaustive catalogue of real-world
shapes this is built to cover (§9).
@GET("/orders")
@Paginated(itemsField = "orders", pointerField = "next")
Page<Order> listOrders(@QueryParam("cursor") @PaginationCursor String cursor);
Every rollout chunk in the design doc's plan (§12) has landed: a
PointerKind.FULL_URL/PointerKind.VALUE pointer sourced
from PaginationSignalSource.RESPONSE_BODY/
PaginationSignalSource.RESPONSE_HEADER/
PaginationSignalSource.ITEM_FIELD (keyset pagination, including
an N-way composite key, and RFC 8288 Link response headers),
resent via @QueryParam/@PathParam/@HeaderParam/
@Body, with hasMoreSource/totalSource/
totalPagesSource termination signals, PaginationAdvance
client-driven offset/page-number advancement when there's no
server-given pointer at all (pointerSource = NONE), and a
Page<T>/Stream<T>/Iterator<T> return type,
including an async first fetch via CompletableFuture<Page<T>>.
Whatever this closed attribute vocabulary can't reach, a
PaginationStrategy parameter is the fully
programmatic escape hatch instead - mutually exclusive with this
annotation on the same method. Only a fully async iteration protocol
(Page<T>.next() itself returning a future) remains deliberately
deferred (§11) - RIP.getClient(...) rejects that shape by name
rather than silently misbehaving at call time.
-
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionHow the client advances when there's no server-given pointer at all (pointerSource = NONE) - only meaningful together withpointerSource = NONE; ahasMoreSource/totalSource/totalPagesSourcetermination signal, if set, still takes precedence over the advance-based fallback (§6.5).Where thehasMoreSource()boolean is read from within that source.Where a "more pages exist" boolean signal is read from, if any - authoritative over pointer presence when set (§6.5).Dotted path to the items array within the response body; empty means the response body itself is the array (no wrapper object).intThe page sizePaginationAdvance.INCREMENT_BY_PAGE_SIZEadvances the offset by, and - absent any other termination signal - compares against the fetched item count to detect a short (final) page.Where the pointer is read from within that source: a dotted body path, a header name, or - forPaginationSignalSource.ITEM_FIELDkeyset pagination - a comma-separated list of item field names for an N-way composite key.Whether the extracted pointer is a complete URL or a bare value to resend via a@PaginationCursorcarrier.Where the next-page pointer is read from.Where thetotalSource()record count is read from within that source.Where thetotalPagesSource()page count is read from within that source.Where a total-page-count signal is read from, if any - compared against a running fetched-pages counter for termination (§6.5).Where a total-record-count signal is read from, if any - compared against a running fetched-items counter for termination (§6.5).
-
Element Details
-
itemsField
String itemsFieldDotted path to the items array within the response body; empty means the response body itself is the array (no wrapper object).- Returns:
- the dotted path to the items array, or
""for the response body itself
- Default:
- ""
-
pointerKind
PointerKind pointerKindWhether the extracted pointer is a complete URL or a bare value to resend via a@PaginationCursorcarrier.- Returns:
- the pointer's kind
- Default:
- VALUE
-
pointerSource
PaginationSignalSource pointerSourceWhere the next-page pointer is read from.- Returns:
- the pointer's source
- Default:
- RESPONSE_BODY
-
pointerField
String pointerFieldWhere the pointer is read from within that source: a dotted body path, a header name, or - forPaginationSignalSource.ITEM_FIELDkeyset pagination - a comma-separated list of item field names for an N-way composite key.- Returns:
- the pointer's field/header name, or comma-separated names for a composite keyset
- Default:
- ""
-
advance
PaginationAdvance advanceHow the client advances when there's no server-given pointer at all (pointerSource = NONE) - only meaningful together withpointerSource = NONE; ahasMoreSource/totalSource/totalPagesSourcetermination signal, if set, still takes precedence over the advance-based fallback (§6.5).- Returns:
- the client-driven advancement style
- Default:
- NONE
-
pageSize
int pageSizeThe page sizePaginationAdvance.INCREMENT_BY_PAGE_SIZEadvances the offset by, and - absent any other termination signal - compares against the fetched item count to detect a short (final) page.- Returns:
- the page size, meaningless unless
advance()isINCREMENT_BY_PAGE_SIZE
- Default:
- 0
-
hasMoreSource
PaginationSignalSource hasMoreSourceWhere a "more pages exist" boolean signal is read from, if any - authoritative over pointer presence when set (§6.5).- Returns:
- the
hasMoresignal's source, orNONEif the API gives no such signal
- Default:
- NONE
-
hasMoreField
String hasMoreFieldWhere thehasMoreSource()boolean is read from within that source.- Returns:
- the
hasMorefield's dotted path or header name
- Default:
- ""
-
totalSource
PaginationSignalSource totalSourceWhere a total-record-count signal is read from, if any - compared against a running fetched-items counter for termination (§6.5).- Returns:
- the total-record-count signal's source, or
NONEif the API gives no such signal
- Default:
- NONE
-
totalField
String totalFieldWhere thetotalSource()record count is read from within that source.- Returns:
- the total-record-count field's dotted path or header name
- Default:
- ""
-
totalPagesSource
PaginationSignalSource totalPagesSourceWhere a total-page-count signal is read from, if any - compared against a running fetched-pages counter for termination (§6.5).- Returns:
- the total-page-count signal's source, or
NONEif the API gives no such signal
- Default:
- NONE
-
totalPagesField
String totalPagesFieldWhere thetotalPagesSource()page count is read from within that source.- Returns:
- the total-page-count field's dotted path or header name
- Default:
- ""
-