Interface PagedQueryResponse

All Superinterfaces:
ResourcePagedQueryResponse<BaseResource>

public interface PagedQueryResponse extends 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 Details

    • getLimit

      @NotNull @NotNull Long getLimit()

      Number of results requested.

      Specified by:
      getLimit in interface ResourcePagedQueryResponse<BaseResource>
      Returns:
      limit
    • getOffset

      @NotNull @NotNull Long getOffset()

      Number of elements skipped.

      Specified by:
      getOffset in interface ResourcePagedQueryResponse<BaseResource>
      Returns:
      offset
    • getCount

      @NotNull @NotNull Long getCount()

      Actual number of results returned.

      Specified by:
      getCount in interface ResourcePagedQueryResponse<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 interface ResourcePagedQueryResponse<BaseResource>
      Returns:
      total
    • getResults

      @NotNull @Valid @NotNull @Valid List<BaseResource> getResults()

      The resources matching the query predicate. Each query endpoint returns resources of its specific type.

      Specified by:
      getResults in interface ResourcePagedQueryResponse<BaseResource>
      Returns:
      results
    • getMeta

      @Valid @Valid Object getMeta()

      Object containing supplementary information about the results.

      Returns:
      meta
    • setLimit

      void setLimit(Long limit)

      Number of results requested.

      Parameters:
      limit - value to be set
    • setOffset

      void setOffset(Long offset)

      Number of elements skipped.

      Parameters:
      offset - value to be set
    • setCount

      void setCount(Long count)

      Actual number of results returned.

      Parameters:
      count - value to be set
    • setTotal

      void setTotal(Long total)

      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

      void setResults(BaseResource... results)

      The resources matching the query predicate. Each query endpoint returns resources of its specific type.

      Parameters:
      results - values to be set
    • setResults

      void setResults(List<BaseResource> results)

      The resources matching the query predicate. Each query endpoint returns resources of its specific type.

      Parameters:
      results - values to be set
    • setMeta

      void setMeta(Object meta)

      Object containing supplementary information about the results.

      Parameters:
      meta - value to be set
    • of

      static PagedQueryResponse of()
      factory method
      Returns:
      instance of PagedQueryResponse
    • of

      static PagedQueryResponse of(PagedQueryResponse template)
      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

      static PagedQueryResponseBuilder builder()
      builder factory method for PagedQueryResponse
      Returns:
      builder
    • builder

      static PagedQueryResponseBuilder builder(PagedQueryResponse template)
      create builder for PagedQueryResponse instance
      Parameters:
      template - instance with prefilled values for the builder
      Returns:
      builder
    • withPagedQueryResponse

      default <T> T withPagedQueryResponse(Function<PagedQueryResponse,T> helper)
      accessor map function
      Type Parameters:
      T - mapped type
      Parameters:
      helper - function to map the object
      Returns:
      mapped value
    • typeReference

      static com.fasterxml.jackson.core.type.TypeReference<PagedQueryResponse> typeReference()
      gives a TypeReference for usage with Jackson DataBind
      Returns:
      TypeReference