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 * SetAssetSourcesChangeBuilder
012 * <hr>
013 * Example to create an instance using the builder pattern
014 * <div class=code-example>
015 * <pre><code class='java'>
016 *     SetAssetSourcesChange setAssetSourcesChange = SetAssetSourcesChange.builder()
017 *             .change("{change}")
018 *             .plusPreviousValue(previousValueBuilder -> previousValueBuilder)
019 *             .plusNextValue(nextValueBuilder -> nextValueBuilder)
020 *             .asset(assetBuilder -> assetBuilder)
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 SetAssetSourcesChangeBuilder implements Builder<SetAssetSourcesChange> {
027
028    private String change;
029
030    private java.util.List<com.commercetools.history.models.common.AssetSource> previousValue;
031
032    private java.util.List<com.commercetools.history.models.common.AssetSource> nextValue;
033
034    private com.commercetools.history.models.change_value.AssetChangeValue asset;
035
036    /**
037     * set the value to the change
038     * @param change value to be set
039     * @return Builder
040     */
041
042    public SetAssetSourcesChangeBuilder 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 SetAssetSourcesChangeBuilder previousValue(
054            final com.commercetools.history.models.common.AssetSource... 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 SetAssetSourcesChangeBuilder previousValue(
066            final java.util.List<com.commercetools.history.models.common.AssetSource> 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 SetAssetSourcesChangeBuilder plusPreviousValue(
078            final com.commercetools.history.models.common.AssetSource... 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 SetAssetSourcesChangeBuilder plusPreviousValue(
093            Function<com.commercetools.history.models.common.AssetSourceBuilder, com.commercetools.history.models.common.AssetSourceBuilder> builder) {
094        if (this.previousValue == null) {
095            this.previousValue = new ArrayList<>();
096        }
097        this.previousValue.add(builder.apply(com.commercetools.history.models.common.AssetSourceBuilder.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 SetAssetSourcesChangeBuilder withPreviousValue(
108            Function<com.commercetools.history.models.common.AssetSourceBuilder, com.commercetools.history.models.common.AssetSourceBuilder> builder) {
109        this.previousValue = new ArrayList<>();
110        this.previousValue.add(builder.apply(com.commercetools.history.models.common.AssetSourceBuilder.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 SetAssetSourcesChangeBuilder addPreviousValue(
121            Function<com.commercetools.history.models.common.AssetSourceBuilder, com.commercetools.history.models.common.AssetSource> builder) {
122        return plusPreviousValue(builder.apply(com.commercetools.history.models.common.AssetSourceBuilder.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 SetAssetSourcesChangeBuilder setPreviousValue(
132            Function<com.commercetools.history.models.common.AssetSourceBuilder, com.commercetools.history.models.common.AssetSource> builder) {
133        return previousValue(builder.apply(com.commercetools.history.models.common.AssetSourceBuilder.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 SetAssetSourcesChangeBuilder nextValue(
143            final com.commercetools.history.models.common.AssetSource... nextValue) {
144        this.nextValue = new ArrayList<>(Arrays.asList(nextValue));
145        return this;
146    }
147
148    /**
149     *  <p>Value after the change.</p>
150     * @param nextValue value to be set
151     * @return Builder
152     */
153
154    public SetAssetSourcesChangeBuilder nextValue(
155            final java.util.List<com.commercetools.history.models.common.AssetSource> nextValue) {
156        this.nextValue = nextValue;
157        return this;
158    }
159
160    /**
161     *  <p>Value after the change.</p>
162     * @param nextValue value to be set
163     * @return Builder
164     */
165
166    public SetAssetSourcesChangeBuilder plusNextValue(
167            final com.commercetools.history.models.common.AssetSource... nextValue) {
168        if (this.nextValue == null) {
169            this.nextValue = new ArrayList<>();
170        }
171        this.nextValue.addAll(Arrays.asList(nextValue));
172        return this;
173    }
174
175    /**
176     *  <p>Value after the change.</p>
177     * @param builder function to build the nextValue value
178     * @return Builder
179     */
180
181    public SetAssetSourcesChangeBuilder plusNextValue(
182            Function<com.commercetools.history.models.common.AssetSourceBuilder, com.commercetools.history.models.common.AssetSourceBuilder> builder) {
183        if (this.nextValue == null) {
184            this.nextValue = new ArrayList<>();
185        }
186        this.nextValue.add(builder.apply(com.commercetools.history.models.common.AssetSourceBuilder.of()).build());
187        return this;
188    }
189
190    /**
191     *  <p>Value after the change.</p>
192     * @param builder function to build the nextValue value
193     * @return Builder
194     */
195
196    public SetAssetSourcesChangeBuilder withNextValue(
197            Function<com.commercetools.history.models.common.AssetSourceBuilder, com.commercetools.history.models.common.AssetSourceBuilder> builder) {
198        this.nextValue = new ArrayList<>();
199        this.nextValue.add(builder.apply(com.commercetools.history.models.common.AssetSourceBuilder.of()).build());
200        return this;
201    }
202
203    /**
204     *  <p>Value after the change.</p>
205     * @param builder function to build the nextValue value
206     * @return Builder
207     */
208
209    public SetAssetSourcesChangeBuilder addNextValue(
210            Function<com.commercetools.history.models.common.AssetSourceBuilder, com.commercetools.history.models.common.AssetSource> builder) {
211        return plusNextValue(builder.apply(com.commercetools.history.models.common.AssetSourceBuilder.of()));
212    }
213
214    /**
215     *  <p>Value after the change.</p>
216     * @param builder function to build the nextValue value
217     * @return Builder
218     */
219
220    public SetAssetSourcesChangeBuilder setNextValue(
221            Function<com.commercetools.history.models.common.AssetSourceBuilder, com.commercetools.history.models.common.AssetSource> builder) {
222        return nextValue(builder.apply(com.commercetools.history.models.common.AssetSourceBuilder.of()));
223    }
224
225    /**
226     *  <p>Information about the updated Asset.</p>
227     * @param builder function to build the asset value
228     * @return Builder
229     */
230
231    public SetAssetSourcesChangeBuilder asset(
232            Function<com.commercetools.history.models.change_value.AssetChangeValueBuilder, com.commercetools.history.models.change_value.AssetChangeValueBuilder> builder) {
233        this.asset = builder.apply(com.commercetools.history.models.change_value.AssetChangeValueBuilder.of()).build();
234        return this;
235    }
236
237    /**
238     *  <p>Information about the updated Asset.</p>
239     * @param builder function to build the asset value
240     * @return Builder
241     */
242
243    public SetAssetSourcesChangeBuilder withAsset(
244            Function<com.commercetools.history.models.change_value.AssetChangeValueBuilder, com.commercetools.history.models.change_value.AssetChangeValue> builder) {
245        this.asset = builder.apply(com.commercetools.history.models.change_value.AssetChangeValueBuilder.of());
246        return this;
247    }
248
249    /**
250     *  <p>Information about the updated Asset.</p>
251     * @param asset value to be set
252     * @return Builder
253     */
254
255    public SetAssetSourcesChangeBuilder asset(
256            final com.commercetools.history.models.change_value.AssetChangeValue asset) {
257        this.asset = asset;
258        return this;
259    }
260
261    /**
262     * value of change}
263     * @return change
264     */
265
266    public String getChange() {
267        return this.change;
268    }
269
270    /**
271     *  <p>Value before the change.</p>
272     * @return previousValue
273     */
274
275    public java.util.List<com.commercetools.history.models.common.AssetSource> getPreviousValue() {
276        return this.previousValue;
277    }
278
279    /**
280     *  <p>Value after the change.</p>
281     * @return nextValue
282     */
283
284    public java.util.List<com.commercetools.history.models.common.AssetSource> getNextValue() {
285        return this.nextValue;
286    }
287
288    /**
289     *  <p>Information about the updated Asset.</p>
290     * @return asset
291     */
292
293    public com.commercetools.history.models.change_value.AssetChangeValue getAsset() {
294        return this.asset;
295    }
296
297    /**
298     * builds SetAssetSourcesChange with checking for non-null required values
299     * @return SetAssetSourcesChange
300     */
301    public SetAssetSourcesChange build() {
302        Objects.requireNonNull(change, SetAssetSourcesChange.class + ": change is missing");
303        Objects.requireNonNull(previousValue, SetAssetSourcesChange.class + ": previousValue is missing");
304        Objects.requireNonNull(nextValue, SetAssetSourcesChange.class + ": nextValue is missing");
305        Objects.requireNonNull(asset, SetAssetSourcesChange.class + ": asset is missing");
306        return new SetAssetSourcesChangeImpl(change, previousValue, nextValue, asset);
307    }
308
309    /**
310     * builds SetAssetSourcesChange without checking for non-null required values
311     * @return SetAssetSourcesChange
312     */
313    public SetAssetSourcesChange buildUnchecked() {
314        return new SetAssetSourcesChangeImpl(change, previousValue, nextValue, asset);
315    }
316
317    /**
318     * factory method for an instance of SetAssetSourcesChangeBuilder
319     * @return builder
320     */
321    public static SetAssetSourcesChangeBuilder of() {
322        return new SetAssetSourcesChangeBuilder();
323    }
324
325    /**
326     * create builder for SetAssetSourcesChange instance
327     * @param template instance with prefilled values for the builder
328     * @return builder
329     */
330    public static SetAssetSourcesChangeBuilder of(final SetAssetSourcesChange template) {
331        SetAssetSourcesChangeBuilder builder = new SetAssetSourcesChangeBuilder();
332        builder.change = template.getChange();
333        builder.previousValue = template.getPreviousValue();
334        builder.nextValue = template.getNextValue();
335        builder.asset = template.getAsset();
336        return builder;
337    }
338
339}