001
002package com.commercetools.ml.models.general_category_recommendations;
003
004import java.util.*;
005import java.util.function.Function;
006
007import io.vrap.rmf.base.client.Builder;
008import io.vrap.rmf.base.client.utils.Generated;
009
010/**
011 * GeneralCategoryRecommendationPagedQueryResponseBuilder
012 * <hr>
013 * Example to create an instance using the builder pattern
014 * <div class=code-example>
015 * <pre><code class='java'>
016 *     GeneralCategoryRecommendationPagedQueryResponse generalCategoryRecommendationPagedQueryResponse = GeneralCategoryRecommendationPagedQueryResponse.builder()
017 *             .count(0.3)
018 *             .total(0.3)
019 *             .offset(0.3)
020 *             .plusResults(resultsBuilder -> resultsBuilder)
021 *             .build()
022 * </code></pre>
023 * </div>
024 */
025@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
026public class GeneralCategoryRecommendationPagedQueryResponseBuilder
027        implements Builder<GeneralCategoryRecommendationPagedQueryResponse> {
028
029    private Long count;
030
031    private Long total;
032
033    private Long offset;
034
035    private java.util.List<com.commercetools.ml.models.general_category_recommendations.GeneralCategoryRecommendation> results;
036
037    /**
038     *
039     */
040
041    public GeneralCategoryRecommendationPagedQueryResponseBuilder count(final Long count) {
042        this.count = count;
043        return this;
044    }
045
046    /**
047     *
048     */
049
050    public GeneralCategoryRecommendationPagedQueryResponseBuilder total(final Long total) {
051        this.total = total;
052        return this;
053    }
054
055    /**
056     *  <p>Number of elements skipped.</p>
057     */
058
059    public GeneralCategoryRecommendationPagedQueryResponseBuilder offset(final Long offset) {
060        this.offset = offset;
061        return this;
062    }
063
064    /**
065     *
066     */
067
068    public GeneralCategoryRecommendationPagedQueryResponseBuilder results(
069            final com.commercetools.ml.models.general_category_recommendations.GeneralCategoryRecommendation... results) {
070        this.results = new ArrayList<>(Arrays.asList(results));
071        return this;
072    }
073
074    /**
075     *
076     */
077
078    public GeneralCategoryRecommendationPagedQueryResponseBuilder results(
079            final java.util.List<com.commercetools.ml.models.general_category_recommendations.GeneralCategoryRecommendation> results) {
080        this.results = results;
081        return this;
082    }
083
084    /**
085     *
086     */
087
088    public GeneralCategoryRecommendationPagedQueryResponseBuilder plusResults(
089            final com.commercetools.ml.models.general_category_recommendations.GeneralCategoryRecommendation... results) {
090        if (this.results == null) {
091            this.results = new ArrayList<>();
092        }
093        this.results.addAll(Arrays.asList(results));
094        return this;
095    }
096
097    /**
098     *
099     */
100
101    public GeneralCategoryRecommendationPagedQueryResponseBuilder plusResults(
102            Function<com.commercetools.ml.models.general_category_recommendations.GeneralCategoryRecommendationBuilder, com.commercetools.ml.models.general_category_recommendations.GeneralCategoryRecommendationBuilder> builder) {
103        if (this.results == null) {
104            this.results = new ArrayList<>();
105        }
106        this.results.add(builder
107                .apply(com.commercetools.ml.models.general_category_recommendations.GeneralCategoryRecommendationBuilder
108                        .of())
109                .build());
110        return this;
111    }
112
113    /**
114     *
115     */
116
117    public GeneralCategoryRecommendationPagedQueryResponseBuilder withResults(
118            Function<com.commercetools.ml.models.general_category_recommendations.GeneralCategoryRecommendationBuilder, com.commercetools.ml.models.general_category_recommendations.GeneralCategoryRecommendationBuilder> builder) {
119        this.results = new ArrayList<>();
120        this.results.add(builder
121                .apply(com.commercetools.ml.models.general_category_recommendations.GeneralCategoryRecommendationBuilder
122                        .of())
123                .build());
124        return this;
125    }
126
127    public Long getCount() {
128        return this.count;
129    }
130
131    public Long getTotal() {
132        return this.total;
133    }
134
135    public Long getOffset() {
136        return this.offset;
137    }
138
139    public java.util.List<com.commercetools.ml.models.general_category_recommendations.GeneralCategoryRecommendation> getResults() {
140        return this.results;
141    }
142
143    public GeneralCategoryRecommendationPagedQueryResponse build() {
144        Objects.requireNonNull(count, GeneralCategoryRecommendationPagedQueryResponse.class + ": count is missing");
145        Objects.requireNonNull(total, GeneralCategoryRecommendationPagedQueryResponse.class + ": total is missing");
146        Objects.requireNonNull(offset, GeneralCategoryRecommendationPagedQueryResponse.class + ": offset is missing");
147        Objects.requireNonNull(results, GeneralCategoryRecommendationPagedQueryResponse.class + ": results is missing");
148        return new GeneralCategoryRecommendationPagedQueryResponseImpl(count, total, offset, results);
149    }
150
151    /**
152     * builds GeneralCategoryRecommendationPagedQueryResponse without checking for non null required values
153     */
154    public GeneralCategoryRecommendationPagedQueryResponse buildUnchecked() {
155        return new GeneralCategoryRecommendationPagedQueryResponseImpl(count, total, offset, results);
156    }
157
158    public static GeneralCategoryRecommendationPagedQueryResponseBuilder of() {
159        return new GeneralCategoryRecommendationPagedQueryResponseBuilder();
160    }
161
162    public static GeneralCategoryRecommendationPagedQueryResponseBuilder of(
163            final GeneralCategoryRecommendationPagedQueryResponse template) {
164        GeneralCategoryRecommendationPagedQueryResponseBuilder builder = new GeneralCategoryRecommendationPagedQueryResponseBuilder();
165        builder.count = template.getCount();
166        builder.total = template.getTotal();
167        builder.offset = template.getOffset();
168        builder.results = template.getResults();
169        return builder;
170    }
171
172}