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 * SetTransitionsChangeBuilder
012 * <hr>
013 * Example to create an instance using the builder pattern
014 * <div class=code-example>
015 * <pre><code class='java'>
016 *     SetTransitionsChange setTransitionsChange = SetTransitionsChange.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 SetTransitionsChangeBuilder implements Builder<SetTransitionsChange> {
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 SetTransitionsChangeBuilder 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 SetTransitionsChangeBuilder 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 SetTransitionsChangeBuilder 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 SetTransitionsChangeBuilder 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 SetTransitionsChangeBuilder 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 SetTransitionsChangeBuilder 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 SetTransitionsChangeBuilder 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 SetTransitionsChangeBuilder 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 SetTransitionsChangeBuilder 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 SetTransitionsChangeBuilder 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 SetTransitionsChangeBuilder plusNextValue(
163            final com.commercetools.history.models.common.Reference... nextValue) {
164        if (this.nextValue == null) {
165            this.nextValue = new ArrayList<>();
166        }
167        this.nextValue.addAll(Arrays.asList(nextValue));
168        return this;
169    }
170
171    /**
172     *  <p>Value after the change.</p>
173     * @param builder function to build the nextValue value
174     * @return Builder
175     */
176
177    public SetTransitionsChangeBuilder plusNextValue(
178            Function<com.commercetools.history.models.common.ReferenceBuilder, com.commercetools.history.models.common.ReferenceBuilder> builder) {
179        if (this.nextValue == null) {
180            this.nextValue = new ArrayList<>();
181        }
182        this.nextValue.add(builder.apply(com.commercetools.history.models.common.ReferenceBuilder.of()).build());
183        return this;
184    }
185
186    /**
187     *  <p>Value after the change.</p>
188     * @param builder function to build the nextValue value
189     * @return Builder
190     */
191
192    public SetTransitionsChangeBuilder withNextValue(
193            Function<com.commercetools.history.models.common.ReferenceBuilder, com.commercetools.history.models.common.ReferenceBuilder> builder) {
194        this.nextValue = new ArrayList<>();
195        this.nextValue.add(builder.apply(com.commercetools.history.models.common.ReferenceBuilder.of()).build());
196        return this;
197    }
198
199    /**
200     *  <p>Value after the change.</p>
201     * @param builder function to build the nextValue value
202     * @return Builder
203     */
204
205    public SetTransitionsChangeBuilder addNextValue(
206            Function<com.commercetools.history.models.common.ReferenceBuilder, com.commercetools.history.models.common.Reference> builder) {
207        return plusNextValue(builder.apply(com.commercetools.history.models.common.ReferenceBuilder.of()));
208    }
209
210    /**
211     *  <p>Value after the change.</p>
212     * @param builder function to build the nextValue value
213     * @return Builder
214     */
215
216    public SetTransitionsChangeBuilder setNextValue(
217            Function<com.commercetools.history.models.common.ReferenceBuilder, com.commercetools.history.models.common.Reference> builder) {
218        return nextValue(builder.apply(com.commercetools.history.models.common.ReferenceBuilder.of()));
219    }
220
221    /**
222     * value of change}
223     * @return change
224     */
225
226    public String getChange() {
227        return this.change;
228    }
229
230    /**
231     *  <p>Value before the change.</p>
232     * @return previousValue
233     */
234
235    public java.util.List<com.commercetools.history.models.common.Reference> getPreviousValue() {
236        return this.previousValue;
237    }
238
239    /**
240     *  <p>Value after the change.</p>
241     * @return nextValue
242     */
243
244    public java.util.List<com.commercetools.history.models.common.Reference> getNextValue() {
245        return this.nextValue;
246    }
247
248    /**
249     * builds SetTransitionsChange with checking for non-null required values
250     * @return SetTransitionsChange
251     */
252    public SetTransitionsChange build() {
253        Objects.requireNonNull(change, SetTransitionsChange.class + ": change is missing");
254        Objects.requireNonNull(previousValue, SetTransitionsChange.class + ": previousValue is missing");
255        Objects.requireNonNull(nextValue, SetTransitionsChange.class + ": nextValue is missing");
256        return new SetTransitionsChangeImpl(change, previousValue, nextValue);
257    }
258
259    /**
260     * builds SetTransitionsChange without checking for non-null required values
261     * @return SetTransitionsChange
262     */
263    public SetTransitionsChange buildUnchecked() {
264        return new SetTransitionsChangeImpl(change, previousValue, nextValue);
265    }
266
267    /**
268     * factory method for an instance of SetTransitionsChangeBuilder
269     * @return builder
270     */
271    public static SetTransitionsChangeBuilder of() {
272        return new SetTransitionsChangeBuilder();
273    }
274
275    /**
276     * create builder for SetTransitionsChange instance
277     * @param template instance with prefilled values for the builder
278     * @return builder
279     */
280    public static SetTransitionsChangeBuilder of(final SetTransitionsChange template) {
281        SetTransitionsChangeBuilder builder = new SetTransitionsChangeBuilder();
282        builder.change = template.getChange();
283        builder.previousValue = template.getPreviousValue();
284        builder.nextValue = template.getNextValue();
285        return builder;
286    }
287
288}