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