Package com.shri.restinpeace
Interface Page<T>
- Type Parameters:
T- the decoded item type
public interface Page<T>
One page of a
@Paginated (or PaginationStrategy<T>)
method's results, for manual, page-at-a-time iteration - see
docs/design/pagination-helper.md §6.4. Declare Stream<T>
or Iterator<T> instead of Page<T> on the exact same
method for auto-flattened, lazy iteration across every page instead of
calling next() by hand.
rawResponse() returns a RipResponse<Void> rather
than a kong.unirest.HttpResponse<?> - RIP's own status/headers
vocabulary, consistent with every other feature's public API, instead of
leaking the underlying HTTP client's type. Its body is always null
since items() already carries this page's decoded content.
-
Method Summary
Modifier and TypeMethodDescriptionbooleanhasNext()Returns whethernext()would fetch another page - per the termination precedence indocs/design/pagination-helper.md§6.5 (ahasMoresignal, then a total-record/total-page comparison, then pointer presence, always layered under an empty-page safety net).items()Returns this page's decoded items, in the order the server returned them.next()Blocking-fetches the next page by re-invoking the exact same annotated method through the client's entire existing call pipeline - retry, cache, circuit breaker, bulkhead, and every registered interceptor - exactly as if the method were called again by hand (§6.9).Returns the status code and headers of the call that produced this page - correct for whichever page is currently held, unlike aRipResponse<Page<T>>would be afternext()advances (see §6.4.1).
-
Method Details
-
items
Returns this page's decoded items, in the order the server returned them.- Returns:
- this page's decoded items
-
hasNext
boolean hasNext()Returns whethernext()would fetch another page - per the termination precedence indocs/design/pagination-helper.md§6.5 (ahasMoresignal, then a total-record/total-page comparison, then pointer presence, always layered under an empty-page safety net).- Returns:
- whether there is a next page to fetch
-
next
Blocking-fetches the next page by re-invoking the exact same annotated method through the client's entire existing call pipeline - retry, cache, circuit breaker, bulkhead, and every registered interceptor - exactly as if the method were called again by hand (§6.9).- Returns:
- the next page
- Throws:
RestInPeaceException- if there is no next page
-
rawResponse
RipResponse<Void> rawResponse()Returns the status code and headers of the call that produced this page - correct for whichever page is currently held, unlike aRipResponse<Page<T>>would be afternext()advances (see §6.4.1).- Returns:
- this page's own response metadata, with a
nullbody
-