Class CartPagedQueryResponseBuilder

java.lang.Object
com.commercetools.api.models.cart.CartPagedQueryResponseBuilder
All Implemented Interfaces:
Builder<CartPagedQueryResponse>

public class CartPagedQueryResponseBuilder extends Object implements Builder<CartPagedQueryResponse>
CartPagedQueryResponseBuilder
Example to create an instance using the builder pattern

     CartPagedQueryResponse cartPagedQueryResponse = CartPagedQueryResponse.builder()
             .limit(0.3)
             .offset(0.3)
             .count(0.3)
             .plusResults(resultsBuilder -> resultsBuilder)
             .build()
 
  • Constructor Details

    • CartPagedQueryResponseBuilder

      public CartPagedQueryResponseBuilder()
  • Method Details

    • limit

      public CartPagedQueryResponseBuilder limit(Long limit)

      Number of results requested.

      Parameters:
      limit - value to be set
      Returns:
      Builder
    • offset

      public CartPagedQueryResponseBuilder offset(Long offset)

      Number of elements skipped.

      Parameters:
      offset - value to be set
      Returns:
      Builder
    • count

      public CartPagedQueryResponseBuilder count(Long count)

      Actual number of results returned.

      Parameters:
      count - value to be set
      Returns:
      Builder
    • 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
      Returns:
      Builder
    • results

      public CartPagedQueryResponseBuilder results(Cart... results)

      Carts matching the query.

      Parameters:
      results - value to be set
      Returns:
      Builder
    • results

      public CartPagedQueryResponseBuilder results(List<Cart> results)

      Carts matching the query.

      Parameters:
      results - value to be set
      Returns:
      Builder
    • plusResults

      public CartPagedQueryResponseBuilder plusResults(Cart... results)

      Carts matching the query.

      Parameters:
      results - value to be set
      Returns:
      Builder
    • plusResults

      Carts matching the query.

      Parameters:
      builder - function to build the results value
      Returns:
      Builder
    • withResults

      Carts matching the query.

      Parameters:
      builder - function to build the results value
      Returns:
      Builder
    • addResults

      Carts matching the query.

      Parameters:
      builder - function to build the results value
      Returns:
      Builder
    • setResults

      Carts matching the query.

      Parameters:
      builder - function to build the results value
      Returns:
      Builder
    • getLimit

      public Long getLimit()

      Number of results requested.

      Returns:
      limit
    • getOffset

      public Long getOffset()

      Number of elements skipped.

      Returns:
      offset
    • getCount

      public Long getCount()

      Actual number of results returned.

      Returns:
      count
    • getTotal

      @Nullable public 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.

      Returns:
      total
    • getResults

      public List<Cart> getResults()

      Carts matching the query.

      Returns:
      results
    • build

      public CartPagedQueryResponse build()
      builds CartPagedQueryResponse with checking for non-null required values
      Specified by:
      build in interface Builder<CartPagedQueryResponse>
      Returns:
      CartPagedQueryResponse
    • buildUnchecked

      public CartPagedQueryResponse buildUnchecked()
      builds CartPagedQueryResponse without checking for non-null required values
      Returns:
      CartPagedQueryResponse
    • of

      public static CartPagedQueryResponseBuilder of()
      factory method for an instance of CartPagedQueryResponseBuilder
      Returns:
      builder
    • of

      create builder for CartPagedQueryResponse instance
      Parameters:
      template - instance with prefilled values for the builder
      Returns:
      builder