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 * SetDeliveryItemsChangeBuilder
012 * <hr>
013 * Example to create an instance using the builder pattern
014 * <div class=code-example>
015 * <pre><code class='java'>
016 *     SetDeliveryItemsChange setDeliveryItemsChange = SetDeliveryItemsChange.builder()
017 *             .change("{change}")
018 *             .plusPreviousValue(previousValueBuilder -> previousValueBuilder)
019 *             .plusNextValue(nextValueBuilder -> nextValueBuilder)
020 *             .deliveryId("{deliveryId}")
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 SetDeliveryItemsChangeBuilder implements Builder<SetDeliveryItemsChange> {
027
028    private String change;
029
030    private java.util.List<com.commercetools.history.models.common.DeliveryItem> previousValue;
031
032    private java.util.List<com.commercetools.history.models.common.DeliveryItem> nextValue;
033
034    private String deliveryId;
035
036    /**
037     * set the value to the change
038     * @param change value to be set
039     * @return Builder
040     */
041
042    public SetDeliveryItemsChangeBuilder 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 SetDeliveryItemsChangeBuilder previousValue(
054            final com.commercetools.history.models.common.DeliveryItem... 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 SetDeliveryItemsChangeBuilder previousValue(
066            final java.util.List<com.commercetools.history.models.common.DeliveryItem> 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 SetDeliveryItemsChangeBuilder plusPreviousValue(
078            final com.commercetools.history.models.common.DeliveryItem... 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 SetDeliveryItemsChangeBuilder plusPreviousValue(
093            Function<com.commercetools.history.models.common.DeliveryItemBuilder, com.commercetools.history.models.common.DeliveryItemBuilder> builder) {
094        if (this.previousValue == null) {
095            this.previousValue = new ArrayList<>();
096        }
097        this.previousValue.add(builder.apply(com.commercetools.history.models.common.DeliveryItemBuilder.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 SetDeliveryItemsChangeBuilder withPreviousValue(
108            Function<com.commercetools.history.models.common.DeliveryItemBuilder, com.commercetools.history.models.common.DeliveryItemBuilder> builder) {
109        this.previousValue = new ArrayList<>();
110        this.previousValue.add(builder.apply(com.commercetools.history.models.common.DeliveryItemBuilder.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 SetDeliveryItemsChangeBuilder addPreviousValue(
121            Function<com.commercetools.history.models.common.DeliveryItemBuilder, com.commercetools.history.models.common.DeliveryItem> builder) {
122        return plusPreviousValue(builder.apply(com.commercetools.history.models.common.DeliveryItemBuilder.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 SetDeliveryItemsChangeBuilder setPreviousValue(
132            Function<com.commercetools.history.models.common.DeliveryItemBuilder, com.commercetools.history.models.common.DeliveryItem> builder) {
133        return previousValue(builder.apply(com.commercetools.history.models.common.DeliveryItemBuilder.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 SetDeliveryItemsChangeBuilder nextValue(
143            final com.commercetools.history.models.common.DeliveryItem... 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 SetDeliveryItemsChangeBuilder nextValue(
155            final java.util.List<com.commercetools.history.models.common.DeliveryItem> 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 SetDeliveryItemsChangeBuilder plusNextValue(
167            final com.commercetools.history.models.common.DeliveryItem... 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 SetDeliveryItemsChangeBuilder plusNextValue(
182            Function<com.commercetools.history.models.common.DeliveryItemBuilder, com.commercetools.history.models.common.DeliveryItemBuilder> builder) {
183        if (this.nextValue == null) {
184            this.nextValue = new ArrayList<>();
185        }
186        this.nextValue.add(builder.apply(com.commercetools.history.models.common.DeliveryItemBuilder.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 SetDeliveryItemsChangeBuilder withNextValue(
197            Function<com.commercetools.history.models.common.DeliveryItemBuilder, com.commercetools.history.models.common.DeliveryItemBuilder> builder) {
198        this.nextValue = new ArrayList<>();
199        this.nextValue.add(builder.apply(com.commercetools.history.models.common.DeliveryItemBuilder.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 SetDeliveryItemsChangeBuilder addNextValue(
210            Function<com.commercetools.history.models.common.DeliveryItemBuilder, com.commercetools.history.models.common.DeliveryItem> builder) {
211        return plusNextValue(builder.apply(com.commercetools.history.models.common.DeliveryItemBuilder.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 SetDeliveryItemsChangeBuilder setNextValue(
221            Function<com.commercetools.history.models.common.DeliveryItemBuilder, com.commercetools.history.models.common.DeliveryItem> builder) {
222        return nextValue(builder.apply(com.commercetools.history.models.common.DeliveryItemBuilder.of()));
223    }
224
225    /**
226     *  <p><code>id</code> of the updated Delivery.</p>
227     * @param deliveryId value to be set
228     * @return Builder
229     */
230
231    public SetDeliveryItemsChangeBuilder deliveryId(final String deliveryId) {
232        this.deliveryId = deliveryId;
233        return this;
234    }
235
236    /**
237     * value of change}
238     * @return change
239     */
240
241    public String getChange() {
242        return this.change;
243    }
244
245    /**
246     *  <p>Value before the change.</p>
247     * @return previousValue
248     */
249
250    public java.util.List<com.commercetools.history.models.common.DeliveryItem> getPreviousValue() {
251        return this.previousValue;
252    }
253
254    /**
255     *  <p>Value after the change.</p>
256     * @return nextValue
257     */
258
259    public java.util.List<com.commercetools.history.models.common.DeliveryItem> getNextValue() {
260        return this.nextValue;
261    }
262
263    /**
264     *  <p><code>id</code> of the updated Delivery.</p>
265     * @return deliveryId
266     */
267
268    public String getDeliveryId() {
269        return this.deliveryId;
270    }
271
272    /**
273     * builds SetDeliveryItemsChange with checking for non-null required values
274     * @return SetDeliveryItemsChange
275     */
276    public SetDeliveryItemsChange build() {
277        Objects.requireNonNull(change, SetDeliveryItemsChange.class + ": change is missing");
278        Objects.requireNonNull(previousValue, SetDeliveryItemsChange.class + ": previousValue is missing");
279        Objects.requireNonNull(nextValue, SetDeliveryItemsChange.class + ": nextValue is missing");
280        Objects.requireNonNull(deliveryId, SetDeliveryItemsChange.class + ": deliveryId is missing");
281        return new SetDeliveryItemsChangeImpl(change, previousValue, nextValue, deliveryId);
282    }
283
284    /**
285     * builds SetDeliveryItemsChange without checking for non-null required values
286     * @return SetDeliveryItemsChange
287     */
288    public SetDeliveryItemsChange buildUnchecked() {
289        return new SetDeliveryItemsChangeImpl(change, previousValue, nextValue, deliveryId);
290    }
291
292    /**
293     * factory method for an instance of SetDeliveryItemsChangeBuilder
294     * @return builder
295     */
296    public static SetDeliveryItemsChangeBuilder of() {
297        return new SetDeliveryItemsChangeBuilder();
298    }
299
300    /**
301     * create builder for SetDeliveryItemsChange instance
302     * @param template instance with prefilled values for the builder
303     * @return builder
304     */
305    public static SetDeliveryItemsChangeBuilder of(final SetDeliveryItemsChange template) {
306        SetDeliveryItemsChangeBuilder builder = new SetDeliveryItemsChangeBuilder();
307        builder.change = template.getChange();
308        builder.previousValue = template.getPreviousValue();
309        builder.nextValue = template.getNextValue();
310        builder.deliveryId = template.getDeliveryId();
311        return builder;
312    }
313
314}