001
002package com.commercetools.api.models.shopping_list;
003
004import java.time.*;
005import java.util.*;
006import java.util.function.Function;
007import java.util.stream.Collectors;
008
009import javax.annotation.Nullable;
010import javax.validation.Valid;
011import javax.validation.constraints.NotNull;
012
013import com.fasterxml.jackson.annotation.*;
014import com.fasterxml.jackson.databind.annotation.*;
015
016import io.vrap.rmf.base.client.utils.Generated;
017
018/**
019 * ShoppingListPagedQueryResponse
020 *
021 * <hr>
022 * Example to create an instance using the builder pattern
023 * <div class=code-example>
024 * <pre><code class='java'>
025 *     ShoppingListPagedQueryResponse shoppingListPagedQueryResponse = ShoppingListPagedQueryResponse.builder()
026 *             .limit(0.3)
027 *             .count(0.3)
028 *             .offset(0.3)
029 *             .plusResults(resultsBuilder -> resultsBuilder)
030 *             .build()
031 * </code></pre>
032 * </div>
033 */
034@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
035@JsonDeserialize(as = ShoppingListPagedQueryResponseImpl.class)
036public interface ShoppingListPagedQueryResponse
037        extends com.commercetools.api.models.ResourcePagedQueryResponse<ShoppingList> {
038
039    /**
040     *  <p>Number of results requested.</p>
041     * @return limit
042     */
043    @NotNull
044    @JsonProperty("limit")
045    public Long getLimit();
046
047    /**
048     *  <p>Actual number of results returned.</p>
049     * @return count
050     */
051    @NotNull
052    @JsonProperty("count")
053    public Long getCount();
054
055    /**
056     *  <p>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 <code>withTotal=false</code>. When the results are filtered with a Query Predicate, <code>total</code> is subject to a limit.</p>
057     * @return total
058     */
059
060    @JsonProperty("total")
061    public Long getTotal();
062
063    /**
064     *  <p>Number of elements skipped.</p>
065     * @return offset
066     */
067    @NotNull
068    @JsonProperty("offset")
069    public Long getOffset();
070
071    /**
072     *  <p>ShoppingLists matching the query.</p>
073     * @return results
074     */
075    @NotNull
076    @Valid
077    @JsonProperty("results")
078    public List<ShoppingList> getResults();
079
080    /**
081     *  <p>Number of results requested.</p>
082     * @param limit value to be set
083     */
084
085    public void setLimit(final Long limit);
086
087    /**
088     *  <p>Actual number of results returned.</p>
089     * @param count value to be set
090     */
091
092    public void setCount(final Long count);
093
094    /**
095     *  <p>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 <code>withTotal=false</code>. When the results are filtered with a Query Predicate, <code>total</code> is subject to a limit.</p>
096     * @param total value to be set
097     */
098
099    public void setTotal(final Long total);
100
101    /**
102     *  <p>Number of elements skipped.</p>
103     * @param offset value to be set
104     */
105
106    public void setOffset(final Long offset);
107
108    /**
109     *  <p>ShoppingLists matching the query.</p>
110     * @param results values to be set
111     */
112
113    @JsonIgnore
114    public void setResults(final ShoppingList... results);
115
116    /**
117     *  <p>ShoppingLists matching the query.</p>
118     * @param results values to be set
119     */
120
121    public void setResults(final List<ShoppingList> results);
122
123    /**
124     * factory method
125     * @return instance of ShoppingListPagedQueryResponse
126     */
127    public static ShoppingListPagedQueryResponse of() {
128        return new ShoppingListPagedQueryResponseImpl();
129    }
130
131    /**
132     * factory method to create a shallow copy ShoppingListPagedQueryResponse
133     * @param template instance to be copied
134     * @return copy instance
135     */
136    public static ShoppingListPagedQueryResponse of(final ShoppingListPagedQueryResponse template) {
137        ShoppingListPagedQueryResponseImpl instance = new ShoppingListPagedQueryResponseImpl();
138        instance.setLimit(template.getLimit());
139        instance.setCount(template.getCount());
140        instance.setTotal(template.getTotal());
141        instance.setOffset(template.getOffset());
142        instance.setResults(template.getResults());
143        return instance;
144    }
145
146    /**
147     * factory method to create a deep copy of ShoppingListPagedQueryResponse
148     * @param template instance to be copied
149     * @return copy instance
150     */
151    @Nullable
152    public static ShoppingListPagedQueryResponse deepCopy(@Nullable final ShoppingListPagedQueryResponse template) {
153        if (template == null) {
154            return null;
155        }
156        ShoppingListPagedQueryResponseImpl instance = new ShoppingListPagedQueryResponseImpl();
157        instance.setLimit(template.getLimit());
158        instance.setCount(template.getCount());
159        instance.setTotal(template.getTotal());
160        instance.setOffset(template.getOffset());
161        instance.setResults(Optional.ofNullable(template.getResults())
162                .map(t -> t.stream()
163                        .map(com.commercetools.api.models.shopping_list.ShoppingList::deepCopy)
164                        .collect(Collectors.toList()))
165                .orElse(null));
166        return instance;
167    }
168
169    /**
170     * builder factory method for ShoppingListPagedQueryResponse
171     * @return builder
172     */
173    public static ShoppingListPagedQueryResponseBuilder builder() {
174        return ShoppingListPagedQueryResponseBuilder.of();
175    }
176
177    /**
178     * create builder for ShoppingListPagedQueryResponse instance
179     * @param template instance with prefilled values for the builder
180     * @return builder
181     */
182    public static ShoppingListPagedQueryResponseBuilder builder(final ShoppingListPagedQueryResponse template) {
183        return ShoppingListPagedQueryResponseBuilder.of(template);
184    }
185
186    /**
187     * accessor map function
188     * @param <T> mapped type
189     * @param helper function to map the object
190     * @return mapped value
191     */
192    default <T> T withShoppingListPagedQueryResponse(Function<ShoppingListPagedQueryResponse, T> helper) {
193        return helper.apply(this);
194    }
195
196    /**
197     * gives a TypeReference for usage with Jackson DataBind
198     * @return TypeReference
199     */
200    public static com.fasterxml.jackson.core.type.TypeReference<ShoppingListPagedQueryResponse> typeReference() {
201        return new com.fasterxml.jackson.core.type.TypeReference<ShoppingListPagedQueryResponse>() {
202            @Override
203            public String toString() {
204                return "TypeReference<ShoppingListPagedQueryResponse>";
205            }
206        };
207    }
208}