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 * SetStoresChangeBuilder
012 * <hr>
013 * Example to create an instance using the builder pattern
014 * <div class=code-example>
015 * <pre><code class='java'>
016 *     SetStoresChange setStoresChange = SetStoresChange.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 SetStoresChangeBuilder implements Builder<SetStoresChange> {
026
027    private String change;
028
029    private java.util.List<com.commercetools.history.models.common.Reference> previousValue;
030
031    private java.util.List<com.commercetools.history.models.common.Reference> nextValue;
032
033    /**
034     * set the value to the change
035     * @param change value to be set
036     * @return Builder
037     */
038
039    public SetStoresChangeBuilder 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 SetStoresChangeBuilder previousValue(
051            final com.commercetools.history.models.common.Reference... 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 SetStoresChangeBuilder previousValue(
063            final java.util.List<com.commercetools.history.models.common.Reference> 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 SetStoresChangeBuilder plusPreviousValue(
075            final com.commercetools.history.models.common.Reference... 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 SetStoresChangeBuilder plusPreviousValue(
090            Function<com.commercetools.history.models.common.ReferenceBuilder, com.commercetools.history.models.common.ReferenceBuilder> builder) {
091        if (this.previousValue == null) {
092            this.previousValue = new ArrayList<>();
093        }
094        this.previousValue.add(builder.apply(com.commercetools.history.models.common.ReferenceBuilder.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 SetStoresChangeBuilder withPreviousValue(
105            Function<com.commercetools.history.models.common.ReferenceBuilder, com.commercetools.history.models.common.ReferenceBuilder> builder) {
106        this.previousValue = new ArrayList<>();
107        this.previousValue.add(builder.apply(com.commercetools.history.models.common.ReferenceBuilder.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 SetStoresChangeBuilder addPreviousValue(
118            Function<com.commercetools.history.models.common.ReferenceBuilder, com.commercetools.history.models.common.Reference> builder) {
119        return plusPreviousValue(builder.apply(com.commercetools.history.models.common.ReferenceBuilder.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 SetStoresChangeBuilder setPreviousValue(
129            Function<com.commercetools.history.models.common.ReferenceBuilder, com.commercetools.history.models.common.Reference> builder) {
130        return previousValue(builder.apply(com.commercetools.history.models.common.ReferenceBuilder.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 SetStoresChangeBuilder nextValue(final com.commercetools.history.models.common.Reference... nextValue) {
140        this.nextValue = new ArrayList<>(Arrays.asList(nextValue));
141        return this;
142    }
143
144    /**
145     *  <p>Value after the change.</p>
146     * @param nextValue value to be set
147     * @return Builder
148     */
149
150    public SetStoresChangeBuilder nextValue(
151            final java.util.List<com.commercetools.history.models.common.Reference> nextValue) {
152        this.nextValue = nextValue;
153        return this;
154    }
155
156    /**
157     *  <p>Value after the change.</p>
158     * @param nextValue value to be set
159     * @return Builder
160     */
161
162    public SetStoresChangeBuilder plusNextValue(final com.commercetools.history.models.common.Reference... nextValue) {
163        if (this.nextValue == null) {
164            this.nextValue = new ArrayList<>();
165        }
166        this.nextValue.addAll(Arrays.asList(nextValue));
167        return this;
168    }
169
170    /**
171     *  <p>Value after the change.</p>
172     * @param builder function to build the nextValue value
173     * @return Builder
174     */
175
176    public SetStoresChangeBuilder plusNextValue(
177            Function<com.commercetools.history.models.common.ReferenceBuilder, com.commercetools.history.models.common.ReferenceBuilder> builder) {
178        if (this.nextValue == null) {
179            this.nextValue = new ArrayList<>();
180        }
181        this.nextValue.add(builder.apply(com.commercetools.history.models.common.ReferenceBuilder.of()).build());
182        return this;
183    }
184
185    /**
186     *  <p>Value after the change.</p>
187     * @param builder function to build the nextValue value
188     * @return Builder
189     */
190
191    public SetStoresChangeBuilder withNextValue(
192            Function<com.commercetools.history.models.common.ReferenceBuilder, com.commercetools.history.models.common.ReferenceBuilder> builder) {
193        this.nextValue = new ArrayList<>();
194        this.nextValue.add(builder.apply(com.commercetools.history.models.common.ReferenceBuilder.of()).build());
195        return this;
196    }
197
198    /**
199     *  <p>Value after the change.</p>
200     * @param builder function to build the nextValue value
201     * @return Builder
202     */
203
204    public SetStoresChangeBuilder addNextValue(
205            Function<com.commercetools.history.models.common.ReferenceBuilder, com.commercetools.history.models.common.Reference> builder) {
206        return plusNextValue(builder.apply(com.commercetools.history.models.common.ReferenceBuilder.of()));
207    }
208
209    /**
210     *  <p>Value after the change.</p>
211     * @param builder function to build the nextValue value
212     * @return Builder
213     */
214
215    public SetStoresChangeBuilder setNextValue(
216            Function<com.commercetools.history.models.common.ReferenceBuilder, com.commercetools.history.models.common.Reference> builder) {
217        return nextValue(builder.apply(com.commercetools.history.models.common.ReferenceBuilder.of()));
218    }
219
220    /**
221     * value of change}
222     * @return change
223     */
224
225    public String getChange() {
226        return this.change;
227    }
228
229    /**
230     *  <p>Value before the change.</p>
231     * @return previousValue
232     */
233
234    public java.util.List<com.commercetools.history.models.common.Reference> getPreviousValue() {
235        return this.previousValue;
236    }
237
238    /**
239     *  <p>Value after the change.</p>
240     * @return nextValue
241     */
242
243    public java.util.List<com.commercetools.history.models.common.Reference> getNextValue() {
244        return this.nextValue;
245    }
246
247    /**
248     * builds SetStoresChange with checking for non-null required values
249     * @return SetStoresChange
250     */
251    public SetStoresChange build() {
252        Objects.requireNonNull(change, SetStoresChange.class + ": change is missing");
253        Objects.requireNonNull(previousValue, SetStoresChange.class + ": previousValue is missing");
254        Objects.requireNonNull(nextValue, SetStoresChange.class + ": nextValue is missing");
255        return new SetStoresChangeImpl(change, previousValue, nextValue);
256    }
257
258    /**
259     * builds SetStoresChange without checking for non-null required values
260     * @return SetStoresChange
261     */
262    public SetStoresChange buildUnchecked() {
263        return new SetStoresChangeImpl(change, previousValue, nextValue);
264    }
265
266    /**
267     * factory method for an instance of SetStoresChangeBuilder
268     * @return builder
269     */
270    public static SetStoresChangeBuilder of() {
271        return new SetStoresChangeBuilder();
272    }
273
274    /**
275     * create builder for SetStoresChange instance
276     * @param template instance with prefilled values for the builder
277     * @return builder
278     */
279    public static SetStoresChangeBuilder of(final SetStoresChange template) {
280        SetStoresChangeBuilder builder = new SetStoresChangeBuilder();
281        builder.change = template.getChange();
282        builder.previousValue = template.getPreviousValue();
283        builder.nextValue = template.getNextValue();
284        return builder;
285    }
286
287}