001
002package com.commercetools.history.models.change;
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 * SetCountriesChangeBuilder
012 * <hr>
013 * Example to create an instance using the builder pattern
014 * <div class=code-example>
015 * <pre><code class='java'>
016 *     SetCountriesChange setCountriesChange = SetCountriesChange.builder()
017 *             .change("{change}")
018 *             .plusPreviousValue(previousValueBuilder -> previousValueBuilder)
019 *             .plusNextValue(nextValueBuilder -> nextValueBuilder)
020 *             .build()
021 * </code></pre>
022 * </div>
023 */
024@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
025public class SetCountriesChangeBuilder implements Builder<SetCountriesChange> {
026
027    private String change;
028
029    private java.util.List<com.commercetools.history.models.common.StoreCountry> previousValue;
030
031    private java.util.List<com.commercetools.history.models.common.StoreCountry> nextValue;
032
033    /**
034     * set the value to the change
035     * @param change value to be set
036     * @return Builder
037     */
038
039    public SetCountriesChangeBuilder change(final String change) {
040        this.change = change;
041        return this;
042    }
043
044    /**
045     *  <p>Value before the change.</p>
046     * @param previousValue value to be set
047     * @return Builder
048     */
049
050    public SetCountriesChangeBuilder previousValue(
051            final com.commercetools.history.models.common.StoreCountry... previousValue) {
052        this.previousValue = new ArrayList<>(Arrays.asList(previousValue));
053        return this;
054    }
055
056    /**
057     *  <p>Value before the change.</p>
058     * @param previousValue value to be set
059     * @return Builder
060     */
061
062    public SetCountriesChangeBuilder previousValue(
063            final java.util.List<com.commercetools.history.models.common.StoreCountry> previousValue) {
064        this.previousValue = previousValue;
065        return this;
066    }
067
068    /**
069     *  <p>Value before the change.</p>
070     * @param previousValue value to be set
071     * @return Builder
072     */
073
074    public SetCountriesChangeBuilder plusPreviousValue(
075            final com.commercetools.history.models.common.StoreCountry... previousValue) {
076        if (this.previousValue == null) {
077            this.previousValue = new ArrayList<>();
078        }
079        this.previousValue.addAll(Arrays.asList(previousValue));
080        return this;
081    }
082
083    /**
084     *  <p>Value before the change.</p>
085     * @param builder function to build the previousValue value
086     * @return Builder
087     */
088
089    public SetCountriesChangeBuilder plusPreviousValue(
090            Function<com.commercetools.history.models.common.StoreCountryBuilder, com.commercetools.history.models.common.StoreCountryBuilder> builder) {
091        if (this.previousValue == null) {
092            this.previousValue = new ArrayList<>();
093        }
094        this.previousValue.add(builder.apply(com.commercetools.history.models.common.StoreCountryBuilder.of()).build());
095        return this;
096    }
097
098    /**
099     *  <p>Value before the change.</p>
100     * @param builder function to build the previousValue value
101     * @return Builder
102     */
103
104    public SetCountriesChangeBuilder withPreviousValue(
105            Function<com.commercetools.history.models.common.StoreCountryBuilder, com.commercetools.history.models.common.StoreCountryBuilder> builder) {
106        this.previousValue = new ArrayList<>();
107        this.previousValue.add(builder.apply(com.commercetools.history.models.common.StoreCountryBuilder.of()).build());
108        return this;
109    }
110
111    /**
112     *  <p>Value before the change.</p>
113     * @param builder function to build the previousValue value
114     * @return Builder
115     */
116
117    public SetCountriesChangeBuilder addPreviousValue(
118            Function<com.commercetools.history.models.common.StoreCountryBuilder, com.commercetools.history.models.common.StoreCountry> builder) {
119        return plusPreviousValue(builder.apply(com.commercetools.history.models.common.StoreCountryBuilder.of()));
120    }
121
122    /**
123     *  <p>Value before the change.</p>
124     * @param builder function to build the previousValue value
125     * @return Builder
126     */
127
128    public SetCountriesChangeBuilder setPreviousValue(
129            Function<com.commercetools.history.models.common.StoreCountryBuilder, com.commercetools.history.models.common.StoreCountry> builder) {
130        return previousValue(builder.apply(com.commercetools.history.models.common.StoreCountryBuilder.of()));
131    }
132
133    /**
134     *  <p>Value after the change.</p>
135     * @param nextValue value to be set
136     * @return Builder
137     */
138
139    public SetCountriesChangeBuilder nextValue(
140            final com.commercetools.history.models.common.StoreCountry... nextValue) {
141        this.nextValue = new ArrayList<>(Arrays.asList(nextValue));
142        return this;
143    }
144
145    /**
146     *  <p>Value after the change.</p>
147     * @param nextValue value to be set
148     * @return Builder
149     */
150
151    public SetCountriesChangeBuilder nextValue(
152            final java.util.List<com.commercetools.history.models.common.StoreCountry> nextValue) {
153        this.nextValue = nextValue;
154        return this;
155    }
156
157    /**
158     *  <p>Value after the change.</p>
159     * @param nextValue value to be set
160     * @return Builder
161     */
162
163    public SetCountriesChangeBuilder plusNextValue(
164            final com.commercetools.history.models.common.StoreCountry... nextValue) {
165        if (this.nextValue == null) {
166            this.nextValue = new ArrayList<>();
167        }
168        this.nextValue.addAll(Arrays.asList(nextValue));
169        return this;
170    }
171
172    /**
173     *  <p>Value after the change.</p>
174     * @param builder function to build the nextValue value
175     * @return Builder
176     */
177
178    public SetCountriesChangeBuilder plusNextValue(
179            Function<com.commercetools.history.models.common.StoreCountryBuilder, com.commercetools.history.models.common.StoreCountryBuilder> builder) {
180        if (this.nextValue == null) {
181            this.nextValue = new ArrayList<>();
182        }
183        this.nextValue.add(builder.apply(com.commercetools.history.models.common.StoreCountryBuilder.of()).build());
184        return this;
185    }
186
187    /**
188     *  <p>Value after the change.</p>
189     * @param builder function to build the nextValue value
190     * @return Builder
191     */
192
193    public SetCountriesChangeBuilder withNextValue(
194            Function<com.commercetools.history.models.common.StoreCountryBuilder, com.commercetools.history.models.common.StoreCountryBuilder> builder) {
195        this.nextValue = new ArrayList<>();
196        this.nextValue.add(builder.apply(com.commercetools.history.models.common.StoreCountryBuilder.of()).build());
197        return this;
198    }
199
200    /**
201     *  <p>Value after the change.</p>
202     * @param builder function to build the nextValue value
203     * @return Builder
204     */
205
206    public SetCountriesChangeBuilder addNextValue(
207            Function<com.commercetools.history.models.common.StoreCountryBuilder, com.commercetools.history.models.common.StoreCountry> builder) {
208        return plusNextValue(builder.apply(com.commercetools.history.models.common.StoreCountryBuilder.of()));
209    }
210
211    /**
212     *  <p>Value after the change.</p>
213     * @param builder function to build the nextValue value
214     * @return Builder
215     */
216
217    public SetCountriesChangeBuilder setNextValue(
218            Function<com.commercetools.history.models.common.StoreCountryBuilder, com.commercetools.history.models.common.StoreCountry> builder) {
219        return nextValue(builder.apply(com.commercetools.history.models.common.StoreCountryBuilder.of()));
220    }
221
222    /**
223     * value of change}
224     * @return change
225     */
226
227    public String getChange() {
228        return this.change;
229    }
230
231    /**
232     *  <p>Value before the change.</p>
233     * @return previousValue
234     */
235
236    public java.util.List<com.commercetools.history.models.common.StoreCountry> getPreviousValue() {
237        return this.previousValue;
238    }
239
240    /**
241     *  <p>Value after the change.</p>
242     * @return nextValue
243     */
244
245    public java.util.List<com.commercetools.history.models.common.StoreCountry> getNextValue() {
246        return this.nextValue;
247    }
248
249    /**
250     * builds SetCountriesChange with checking for non-null required values
251     * @return SetCountriesChange
252     */
253    public SetCountriesChange build() {
254        Objects.requireNonNull(change, SetCountriesChange.class + ": change is missing");
255        Objects.requireNonNull(previousValue, SetCountriesChange.class + ": previousValue is missing");
256        Objects.requireNonNull(nextValue, SetCountriesChange.class + ": nextValue is missing");
257        return new SetCountriesChangeImpl(change, previousValue, nextValue);
258    }
259
260    /**
261     * builds SetCountriesChange without checking for non-null required values
262     * @return SetCountriesChange
263     */
264    public SetCountriesChange buildUnchecked() {
265        return new SetCountriesChangeImpl(change, previousValue, nextValue);
266    }
267
268    /**
269     * factory method for an instance of SetCountriesChangeBuilder
270     * @return builder
271     */
272    public static SetCountriesChangeBuilder of() {
273        return new SetCountriesChangeBuilder();
274    }
275
276    /**
277     * create builder for SetCountriesChange instance
278     * @param template instance with prefilled values for the builder
279     * @return builder
280     */
281    public static SetCountriesChangeBuilder of(final SetCountriesChange template) {
282        SetCountriesChangeBuilder builder = new SetCountriesChangeBuilder();
283        builder.change = template.getChange();
284        builder.previousValue = template.getPreviousValue();
285        builder.nextValue = template.getNextValue();
286        return builder;
287    }
288
289}