Class PaginationRequestImpl

java.lang.Object
com.shri.restinpeace.internal.PaginationRequestImpl
All Implemented Interfaces:
PaginationRequest

public final class PaginationRequestImpl extends Object implements PaginationRequest
The sole implementation of PaginationRequest - constructed only via its static factory methods (which this class's own statics back) and and(com.shri.restinpeace.PaginationRequest). Public only because PaginationRequest's factory methods, in a different package, need to construct it; a PaginationStrategy never sees this type directly, only the PaginationRequest interface. PaginationCoordinator reads its fields directly (same package) to build the next page's fetch.
  • Method Details

    • toUrl

      public static PaginationRequestImpl toUrl(String url)
      Description copied from interface: PaginationRequest
      Follows the given URL verbatim for the next page, bypassing the method's own URL template entirely - the PaginationStrategy counterpart of pointerKind = FULL_URL.
      Parameters:
      url - the next page's absolute URL
      Returns:
      a request that follows url verbatim
    • withQueryParam

      public static PaginationRequestImpl withQueryParam(String name, Object value)
      Description copied from interface: PaginationRequest
      Sets (or overrides) a query parameter on the next request.
      Parameters:
      name - the query parameter's name
      value - the query parameter's value
      Returns:
      a request with name set to value
    • withPathParam

      public static PaginationRequestImpl withPathParam(String name, Object value)
      Description copied from interface: PaginationRequest
      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 template
      value - the path parameter's value
      Returns:
      a request with name set to value
    • withHeader

      public static PaginationRequestImpl withHeader(String name, Object value)
      Description copied from interface: PaginationRequest
      Sets (or overrides) a request header on the next request.
      Parameters:
      name - the header's name
      value - the header's value
      Returns:
      a request with header name set to value
    • withBodyField

      public static PaginationRequestImpl withBodyField(String dottedPath, Object value)
      Description copied from interface: PaginationRequest
      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 @Paginated path.
      Parameters:
      dottedPath - the JSON path inside the body to set
      value - the value to set it to
      Returns:
      a request with dottedPath set to value
    • and

      Description copied from interface: PaginationRequest
      Combines this request's overrides with other's - for a composite key needing more than one override applied to the same next request (e.g. two PaginationRequest.withBodyField(java.lang.String, java.lang.Object) calls for a two-column keyset).
      Specified by:
      and in interface PaginationRequest
      Parameters:
      other - the other overrides to combine with this one's
      Returns:
      a request carrying both this one's and other's overrides
    • url

      public String url()
    • queryParams

      public Map<String,Object> queryParams()
    • pathParams

      public Map<String,Object> pathParams()
    • headers

      public Map<String,Object> headers()
    • bodyFields

      public Map<String,Object> bodyFields()