Interface PaginatedCallAdapter<T>
- Type Parameters:
T- the adapted return type this instance produces
@Paginated method's page sequence into a consumer-chosen
return type T - the pagination-aware counterpart of
CallAdapter, for a return type built around fetching more than one
page over time (e.g. Project Reactor's Flux<T>, via the separate
rest-in-peace-reactor module) rather than a single response.
Registered via
RIP.addPaginatedCallAdapterFactory(PaginatedCallAdapterFactory).
See docs/design/reactor-call-adapter.md ยง7.2.
Like CallAdapter, an adapter never dispatches its own HTTP call -
adapt(java.util.function.Supplier<com.shri.restinpeace.Page<java.lang.Object>>) only ever consumes the firstPageSupplier RIP's own
@Paginated dispatch already built, guaranteeing every page fetch
still goes through the identical pipeline (retry, cache, circuit breaker,
bulkhead, interceptors) as a hand-written call to the same method - the
same guarantee Page<T>/Stream<T>/Iterator<T>'s own
page-at-a-time iteration already has.
The claimed method's return type must declare exactly one type
parameter - the page item type. RIP resolves the item type to decode
each page's items into from that single type argument
(Flux<Order>'s Order, say); a claimed return type declared
with more than one type parameter (e.g. a hypothetical
Result<Metadata, Order>) has no way to tell RIP which one is the
item type, so both RIP.getClient(...) validation and dispatch
reject it by name rather than silently decoding the wrong argument.
-
Method Summary
-
Method Details
-
adapt
Adapts a@Paginatedmethod's page sequence intoT.- Parameters:
firstPageSupplier- fetches the first page, called at most once -Page.next()on the result (and on every page after it) fetches the next one, through the exact same pipeline, exactly asPage<T>'s own consumer-driven iteration does- Returns:
- the adapted value to return from the annotated method
-