001
002package com.commercetools.api.models.zone;
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 *  <p>PagedQueryResult with <code>results</code> containing an array of Zone.</p>
020 *
021 * <hr>
022 * Example to create an instance using the builder pattern
023 * <div class=code-example>
024 * <pre><code class='java'>
025 *     ZonePagedQueryResponse zonePagedQueryResponse = ZonePagedQueryResponse.builder()
026 *             .limit(0.3)
027 *             .offset(0.3)
028 *             .count(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 = ZonePagedQueryResponseImpl.class)
036public interface ZonePagedQueryResponse extends com.commercetools.api.models.ResourcePagedQueryResponse<Zone> {
037
038    /**
039     *  <p>Number of results requested.</p>
040     * @return limit
041     */
042    @NotNull
043    @JsonProperty("limit")
044    public Long getLimit();
045
046    /**
047     *  <p>Number of elements skipped.</p>
048     * @return offset
049     */
050    @NotNull
051    @JsonProperty("offset")
052    public Long getOffset();
053
054    /**
055     *  <p>Actual number of results returned.</p>
056     * @return count
057     */
058    @NotNull
059    @JsonProperty("count")
060    public Long getCount();
061
062    /**
063     *  <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>
064     * @return total
065     */
066
067    @JsonProperty("total")
068    public Long getTotal();
069
070    /**
071     *  <p>Zones matching the query.</p>
072     * @return results
073     */
074    @NotNull
075    @Valid
076    @JsonProperty("results")
077    public List<Zone> getResults();
078
079    /**
080     *  <p>Number of results requested.</p>
081     * @param limit value to be set
082     */
083
084    public void setLimit(final Long limit);
085
086    /**
087     *  <p>Number of elements skipped.</p>
088     * @param offset value to be set
089     */
090
091    public void setOffset(final Long offset);
092
093    /**
094     *  <p>Actual number of results returned.</p>
095     * @param count value to be set
096     */
097
098    public void setCount(final Long count);
099
100    /**
101     *  <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>
102     * @param total value to be set
103     */
104
105    public void setTotal(final Long total);
106
107    /**
108     *  <p>Zones matching the query.</p>
109     * @param results values to be set
110     */
111
112    @JsonIgnore
113    public void setResults(final Zone... results);
114
115    /**
116     *  <p>Zones matching the query.</p>
117     * @param results values to be set
118     */
119
120    public void setResults(final List<Zone> results);
121
122    /**
123     * factory method
124     * @return instance of ZonePagedQueryResponse
125     */
126    public static ZonePagedQueryResponse of() {
127        return new ZonePagedQueryResponseImpl();
128    }
129
130    /**
131     * factory method to create a shallow copy ZonePagedQueryResponse
132     * @param template instance to be copied
133     * @return copy instance
134     */
135    public static ZonePagedQueryResponse of(final ZonePagedQueryResponse template) {
136        ZonePagedQueryResponseImpl instance = new ZonePagedQueryResponseImpl();
137        instance.setLimit(template.getLimit());
138        instance.setOffset(template.getOffset());
139        instance.setCount(template.getCount());
140        instance.setTotal(template.getTotal());
141        instance.setResults(template.getResults());
142        return instance;
143    }
144
145    /**
146     * factory method to create a deep copy of ZonePagedQueryResponse
147     * @param template instance to be copied
148     * @return copy instance
149     */
150    @Nullable
151    public static ZonePagedQueryResponse deepCopy(@Nullable final ZonePagedQueryResponse template) {
152        if (template == null) {
153            return null;
154        }
155        ZonePagedQueryResponseImpl instance = new ZonePagedQueryResponseImpl();
156        instance.setLimit(template.getLimit());
157        instance.setOffset(template.getOffset());
158        instance.setCount(template.getCount());
159        instance.setTotal(template.getTotal());
160        instance.setResults(Optional.ofNullable(template.getResults())
161                .map(t -> t.stream().map(com.commercetools.api.models.zone.Zone::deepCopy).collect(Collectors.toList()))
162                .orElse(null));
163        return instance;
164    }
165
166    /**
167     * builder factory method for ZonePagedQueryResponse
168     * @return builder
169     */
170    public static ZonePagedQueryResponseBuilder builder() {
171        return ZonePagedQueryResponseBuilder.of();
172    }
173
174    /**
175     * create builder for ZonePagedQueryResponse instance
176     * @param template instance with prefilled values for the builder
177     * @return builder
178     */
179    public static ZonePagedQueryResponseBuilder builder(final ZonePagedQueryResponse template) {
180        return ZonePagedQueryResponseBuilder.of(template);
181    }
182
183    /**
184     * accessor map function
185     * @param <T> mapped type
186     * @param helper function to map the object
187     * @return mapped value
188     */
189    default <T> T withZonePagedQueryResponse(Function<ZonePagedQueryResponse, T> helper) {
190        return helper.apply(this);
191    }
192
193    /**
194     * gives a TypeReference for usage with Jackson DataBind
195     * @return TypeReference
196     */
197    public static com.fasterxml.jackson.core.type.TypeReference<ZonePagedQueryResponse> typeReference() {
198        return new com.fasterxml.jackson.core.type.TypeReference<ZonePagedQueryResponse>() {
199            @Override
200            public String toString() {
201                return "TypeReference<ZonePagedQueryResponse>";
202            }
203        };
204    }
205}