Class PaginatedRequest<T>

java.lang.Object
com.eqixiac.equinix.core.http.request.EquinixRequest<T>
com.eqixiac.equinix.core.http.request.PaginatedRequest<T>
Type Parameters:
T - the operation's model type

public final class PaginatedRequest<T> extends EquinixRequest<T>
Request carrier for offset/limit-paginated GET list operations. Holds the raw paging state (offset/pageSize) as plain fields; setPagination() writes them onto the wire as offset/limit query parameters at dispatch.
Author:
ianjones
  • Constructor Details

    • PaginatedRequest

      public PaginatedRequest()
  • Method Details

    • seekPage

      public void seekPage(long offset, long limit)
      Points the request's paging window at the page starting at offset, sized limit. The paging pipeline calls this with the server-reported pagination (next page: serverOffset + serverLimit; rollback after a failed fetch: serverOffset). Advancing from the server-reported window - rather than by the caller-requested page size - is what keeps paging correct when the server clamps the requested limit (e.g. Fabric caps limit at 100): a caller-side offset += requestedPageSize advance would skip every record between the clamped and the requested page size.
      Parameters:
      offset - the zero-based index of the first record of the requested page (floored at 0)
      limit - the page size; non-positive values are ignored and the current page size kept
    • seedPagingFromQueryParams

      public void seedPagingFromQueryParams()
      Seeds offset/pageSize from any caller-supplied offset/limit query parameters, so setPagination() (invoked at dispatch) preserves the requested window on the first page (subsequent pages are seeked from the server-reported pagination via seekPage(long, long)). Without this, setPagination() would overwrite caller-supplied offset/limit with the defaults (offset 0, limit PAGE_LIMIT).

      The caller's offset is carried verbatim: paging is modelled as a raw offset, not a page number, so offsets that are not a multiple of the limit (e.g. offset=5, limit=100) are preserved exactly rather than being quantized to the nearest page boundary.

    • setPagination

      public void setPagination()