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
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
-
Field Summary
Fields inherited from class EquinixRequest
queryParameters -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidSeedsoffset/pageSizefrom any caller-suppliedoffset/limitquery parameters, sosetPagination()(invoked at dispatch) preserves the requested window on the first page (subsequent pages are seeked from the server-reported pagination viaseekPage(long, long)).voidseekPage(long offset, long limit) Points the request's paging window at the page starting atoffset, sizedlimit.voidMethods inherited from class EquinixRequest
addHeader, addPathParameter, addQueryParameter, addQueryParameters, addSingleQueryParameter, replaceQueryParameter, setHeaders, setPathParameters, setQueryParametersModifier and TypeMethodDescriptionvoidvoidaddPathParameter(String parameterName, String parameterValue) voidaddQueryParameter(String parameterName, List<String> parameterValues) voidaddQueryParameters(Map<String, List<String>> parameterValues) voidaddSingleQueryParameter(String parameterName, String parameterValue) voidreplaceQueryParameter(String parameterName, List<String> parameterValues) voidsetHeaders(Map<String, String> headers) Sets the headers, defensively copying into a mutable map (mirrorsEquinixRequest.setQueryParameters(Map):addHeadermutates the stored map, so an immutable caller-supplied map must not be stored by reference).voidsetPathParameters(Map<String, String> pathParameters) Sets the path parameters, defensively copying into a mutable map (mirrorsEquinixRequest.setQueryParameters(Map):addPathParametermutates the stored map, so an immutable caller-supplied map - e.g.voidsetQueryParameters(Map<String, List<String>> queryParameters) Sets the query parameters, defensively deep-copying into a mutable map with mutable value lists.
-
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 atoffset, sizedlimit. 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 capslimitat 100): a caller-sideoffset += requestedPageSizeadvance 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()Seedsoffset/pageSizefrom any caller-suppliedoffset/limitquery parameters, sosetPagination()(invoked at dispatch) preserves the requested window on the first page (subsequent pages are seeked from the server-reported pagination viaseekPage(long, long)). Without this,setPagination()would overwrite caller-suppliedoffset/limitwith the defaults (offset 0, limitPAGE_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()
-