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