Interface PagedQueryResponse
- All Superinterfaces:
ResourcePagedQueryResponse<BaseResource>
Each query endpoint returns a paged query response containing the actual resources matching the query predicate plus information about pagination. This documents the fields all query responses have in common, for specific response types, see the respective API reference pages.
Example to create an instance using the builder pattern
PagedQueryResponse pagedQueryResponse = PagedQueryResponse.builder()
.limit(0.3)
.offset(0.3)
.count(0.3)
.plusResults(resultsBuilder -> resultsBuilder)
.build()
-
Method Summary
Modifier and TypeMethodDescriptionstatic PagedQueryResponseBuilder
builder()
builder factory method for PagedQueryResponsestatic PagedQueryResponseBuilder
builder
(PagedQueryResponse template) create builder for PagedQueryResponse instancestatic PagedQueryResponse
deepCopy
(PagedQueryResponse template) factory method to create a deep copy of PagedQueryResponse@NotNull Long
getCount()
Actual number of results returned.@NotNull Long
getLimit()
Number of results requested.@Valid Object
getMeta()
Object containing supplementary information about the results.@NotNull Long
Number of elements skipped.@NotNull @Valid List<BaseResource>
The resources matching the query predicate.getTotal()
Total number of results matching the query.static PagedQueryResponse
of()
factory methodstatic PagedQueryResponse
of
(PagedQueryResponse template) factory method to create a shallow copy PagedQueryResponsevoid
Actual number of results returned.void
Number of results requested.void
Object containing supplementary information about the results.void
Number of elements skipped.void
setResults
(BaseResource... results) The resources matching the query predicate.void
setResults
(List<BaseResource> results) The resources matching the query predicate.void
Total number of results matching the query.static com.fasterxml.jackson.core.type.TypeReference<PagedQueryResponse>
gives a TypeReference for usage with Jackson DataBinddefault <T> T
withPagedQueryResponse
(Function<PagedQueryResponse, T> helper) accessor map functionMethods inherited from interface com.commercetools.api.models.ResourcePagedQueryResponse
getPageIndex, getTotalPages, head, isFirst, isLast
-
Method Details
-
getLimit
Number of results requested.
- Specified by:
getLimit
in interfaceResourcePagedQueryResponse<BaseResource>
- Returns:
- limit
-
getOffset
Number of elements skipped.
- Specified by:
getOffset
in interfaceResourcePagedQueryResponse<BaseResource>
- Returns:
- offset
-
getCount
Actual number of results returned.
- Specified by:
getCount
in interfaceResourcePagedQueryResponse<BaseResource>
- Returns:
- count
-
getTotal
Long getTotal()Total number of results matching the query. This number is an estimation that is not strongly consistent. This field is returned by default. For improved performance, calculating this field can be deactivated by using the query parameter
withTotal=false
. When the results are filtered with a Query Predicate,total
is subject to a limit.- Specified by:
getTotal
in interfaceResourcePagedQueryResponse<BaseResource>
- Returns:
- total
-
getResults
The resources matching the query predicate. Each query endpoint returns resources of its specific type.
- Specified by:
getResults
in interfaceResourcePagedQueryResponse<BaseResource>
- Returns:
- results
-
getMeta
Object containing supplementary information about the results.
- Returns:
- meta
-
setLimit
Number of results requested.
- Parameters:
limit
- value to be set
-
setOffset
Number of elements skipped.
- Parameters:
offset
- value to be set
-
setCount
Actual number of results returned.
- Parameters:
count
- value to be set
-
setTotal
Total number of results matching the query. This number is an estimation that is not strongly consistent. This field is returned by default. For improved performance, calculating this field can be deactivated by using the query parameter
withTotal=false
. When the results are filtered with a Query Predicate,total
is subject to a limit.- Parameters:
total
- value to be set
-
setResults
The resources matching the query predicate. Each query endpoint returns resources of its specific type.
- Parameters:
results
- values to be set
-
setResults
The resources matching the query predicate. Each query endpoint returns resources of its specific type.
- Parameters:
results
- values to be set
-
setMeta
Object containing supplementary information about the results.
- Parameters:
meta
- value to be set
-
of
factory method- Returns:
- instance of PagedQueryResponse
-
of
factory method to create a shallow copy PagedQueryResponse- Parameters:
template
- instance to be copied- Returns:
- copy instance
-
deepCopy
factory method to create a deep copy of PagedQueryResponse- Parameters:
template
- instance to be copied- Returns:
- copy instance
-
builder
builder factory method for PagedQueryResponse- Returns:
- builder
-
builder
create builder for PagedQueryResponse instance- Parameters:
template
- instance with prefilled values for the builder- Returns:
- builder
-
withPagedQueryResponse
accessor map function- Type Parameters:
T
- mapped type- Parameters:
helper
- function to map the object- Returns:
- mapped value
-
typeReference
gives a TypeReference for usage with Jackson DataBind- Returns:
- TypeReference
-