Package com.shri.restinpeace
Interface PaginationRequest
- All Known Implementing Classes:
PaginationRequestImpl
public interface PaginationRequest
What a
PaginationStrategy's next request should look like - built
exclusively via the static factory methods below (this interface isn't
meant to be implemented directly), and combinable via and(com.shri.restinpeace.PaginationRequest) when
more than one override applies at once (a composite keyset needing two
request-body fields set, for instance). See
docs/design/pagination-helper.md §6.8 and its exhaustive §9
catalogue for real-world examples of each factory method in use.-
Method Summary
Modifier and TypeMethodDescriptionand(PaginationRequest other) Combines this request's overrides withother's - for a composite key needing more than one override applied to the same next request (e.g. twowithBodyField(java.lang.String, java.lang.Object)calls for a two-column keyset).static PaginationRequestFollows the given URL verbatim for the next page, bypassing the method's own URL template entirely - thePaginationStrategycounterpart ofpointerKind = FULL_URL.static PaginationRequestwithBodyField(String dottedPath, Object value) Sets (or overrides) a dotted-path field within the next request's JSON body - the method must declare a@Body Map<String,Object>parameter for this to apply to, the same carrier shape §6.7 uses for the declarative@Paginatedpath.static PaginationRequestwithHeader(String name, Object value) Sets (or overrides) a request header on the next request.static PaginationRequestwithPathParam(String name, Object value) Sets (or overrides) a{name}URL path placeholder on the next request.static PaginationRequestwithQueryParam(String name, Object value) Sets (or overrides) a query parameter on the next request.
-
Method Details
-
toUrl
Follows the given URL verbatim for the next page, bypassing the method's own URL template entirely - thePaginationStrategycounterpart ofpointerKind = FULL_URL.- Parameters:
url- the next page's absolute URL- Returns:
- a request that follows
urlverbatim
-
withQueryParam
Sets (or overrides) a query parameter on the next request.- Parameters:
name- the query parameter's namevalue- the query parameter's value- Returns:
- a request with
nameset tovalue
-
withPathParam
Sets (or overrides) a{name}URL path placeholder on the next request.- Parameters:
name- the path parameter's name, matching a{name}placeholder in the method's URL templatevalue- the path parameter's value- Returns:
- a request with
nameset tovalue
-
withHeader
Sets (or overrides) a request header on the next request.- Parameters:
name- the header's namevalue- the header's value- Returns:
- a request with header
nameset tovalue
-
withBodyField
Sets (or overrides) a dotted-path field within the next request's JSON body - the method must declare a@Body Map<String,Object>parameter for this to apply to, the same carrier shape §6.7 uses for the declarative@Paginatedpath.- Parameters:
dottedPath- the JSON path inside the body to setvalue- the value to set it to- Returns:
- a request with
dottedPathset tovalue
-
and
Combines this request's overrides withother's - for a composite key needing more than one override applied to the same next request (e.g. twowithBodyField(java.lang.String, java.lang.Object)calls for a two-column keyset).- Parameters:
other- the other overrides to combine with this one's- Returns:
- a request carrying both this one's and
other's overrides
-