001
002package com.commercetools.history.models.change;
003
004import java.util.*;
005
006import io.vrap.rmf.base.client.Builder;
007import io.vrap.rmf.base.client.utils.Generated;
008
009/**
010 * AddStateRolesChangeBuilder
011 * <hr>
012 * Example to create an instance using the builder pattern
013 * <div class=code-example>
014 * <pre><code class='java'>
015 *     AddStateRolesChange addStateRolesChange = AddStateRolesChange.builder()
016 *             .change("{change}")
017 *             .plusPreviousValue(previousValueBuilder -> previousValueBuilder)
018 *             .plusNextValue(nextValueBuilder -> nextValueBuilder)
019 *             .build()
020 * </code></pre>
021 * </div>
022 */
023@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
024public class AddStateRolesChangeBuilder implements Builder<AddStateRolesChange> {
025
026    private String change;
027
028    private java.util.List<com.commercetools.history.models.common.StateRole> previousValue;
029
030    private java.util.List<com.commercetools.history.models.common.StateRole> nextValue;
031
032    /**
033     * set the value to the change
034     * @param change value to be set
035     * @return Builder
036     */
037
038    public AddStateRolesChangeBuilder change(final String change) {
039        this.change = change;
040        return this;
041    }
042
043    /**
044     *  <p>Value before the change.</p>
045     * @param previousValue value to be set
046     * @return Builder
047     */
048
049    public AddStateRolesChangeBuilder previousValue(
050            final com.commercetools.history.models.common.StateRole... previousValue) {
051        this.previousValue = new ArrayList<>(Arrays.asList(previousValue));
052        return this;
053    }
054
055    /**
056     *  <p>Value before the change.</p>
057     * @param previousValue value to be set
058     * @return Builder
059     */
060
061    public AddStateRolesChangeBuilder previousValue(
062            final java.util.List<com.commercetools.history.models.common.StateRole> previousValue) {
063        this.previousValue = previousValue;
064        return this;
065    }
066
067    /**
068     *  <p>Value before the change.</p>
069     * @param previousValue value to be set
070     * @return Builder
071     */
072
073    public AddStateRolesChangeBuilder plusPreviousValue(
074            final com.commercetools.history.models.common.StateRole... previousValue) {
075        if (this.previousValue == null) {
076            this.previousValue = new ArrayList<>();
077        }
078        this.previousValue.addAll(Arrays.asList(previousValue));
079        return this;
080    }
081
082    /**
083     *  <p>Value after the change.</p>
084     * @param nextValue value to be set
085     * @return Builder
086     */
087
088    public AddStateRolesChangeBuilder nextValue(final com.commercetools.history.models.common.StateRole... nextValue) {
089        this.nextValue = new ArrayList<>(Arrays.asList(nextValue));
090        return this;
091    }
092
093    /**
094     *  <p>Value after the change.</p>
095     * @param nextValue value to be set
096     * @return Builder
097     */
098
099    public AddStateRolesChangeBuilder nextValue(
100            final java.util.List<com.commercetools.history.models.common.StateRole> nextValue) {
101        this.nextValue = nextValue;
102        return this;
103    }
104
105    /**
106     *  <p>Value after the change.</p>
107     * @param nextValue value to be set
108     * @return Builder
109     */
110
111    public AddStateRolesChangeBuilder plusNextValue(
112            final com.commercetools.history.models.common.StateRole... nextValue) {
113        if (this.nextValue == null) {
114            this.nextValue = new ArrayList<>();
115        }
116        this.nextValue.addAll(Arrays.asList(nextValue));
117        return this;
118    }
119
120    /**
121     * value of change}
122     * @return change
123     */
124
125    public String getChange() {
126        return this.change;
127    }
128
129    /**
130     *  <p>Value before the change.</p>
131     * @return previousValue
132     */
133
134    public java.util.List<com.commercetools.history.models.common.StateRole> getPreviousValue() {
135        return this.previousValue;
136    }
137
138    /**
139     *  <p>Value after the change.</p>
140     * @return nextValue
141     */
142
143    public java.util.List<com.commercetools.history.models.common.StateRole> getNextValue() {
144        return this.nextValue;
145    }
146
147    /**
148     * builds AddStateRolesChange with checking for non-null required values
149     * @return AddStateRolesChange
150     */
151    public AddStateRolesChange build() {
152        Objects.requireNonNull(change, AddStateRolesChange.class + ": change is missing");
153        Objects.requireNonNull(previousValue, AddStateRolesChange.class + ": previousValue is missing");
154        Objects.requireNonNull(nextValue, AddStateRolesChange.class + ": nextValue is missing");
155        return new AddStateRolesChangeImpl(change, previousValue, nextValue);
156    }
157
158    /**
159     * builds AddStateRolesChange without checking for non-null required values
160     * @return AddStateRolesChange
161     */
162    public AddStateRolesChange buildUnchecked() {
163        return new AddStateRolesChangeImpl(change, previousValue, nextValue);
164    }
165
166    /**
167     * factory method for an instance of AddStateRolesChangeBuilder
168     * @return builder
169     */
170    public static AddStateRolesChangeBuilder of() {
171        return new AddStateRolesChangeBuilder();
172    }
173
174    /**
175     * create builder for AddStateRolesChange instance
176     * @param template instance with prefilled values for the builder
177     * @return builder
178     */
179    public static AddStateRolesChangeBuilder of(final AddStateRolesChange template) {
180        AddStateRolesChangeBuilder builder = new AddStateRolesChangeBuilder();
181        builder.change = template.getChange();
182        builder.previousValue = template.getPreviousValue();
183        builder.nextValue = template.getNextValue();
184        return builder;
185    }
186
187}