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 * SetPermissionsChangeBuilder
011 * <hr>
012 * Example to create an instance using the builder pattern
013 * <div class=code-example>
014 * <pre><code class='java'>
015 *     SetPermissionsChange setPermissionsChange = SetPermissionsChange.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 SetPermissionsChangeBuilder implements Builder<SetPermissionsChange> {
025
026    private String change;
027
028    private java.util.List<com.commercetools.history.models.common.Permission> previousValue;
029
030    private java.util.List<com.commercetools.history.models.common.Permission> nextValue;
031
032    /**
033     * set the value to the change
034     * @param change value to be set
035     * @return Builder
036     */
037
038    public SetPermissionsChangeBuilder 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 SetPermissionsChangeBuilder previousValue(
050            final com.commercetools.history.models.common.Permission... 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 SetPermissionsChangeBuilder previousValue(
062            final java.util.List<com.commercetools.history.models.common.Permission> 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 SetPermissionsChangeBuilder plusPreviousValue(
074            final com.commercetools.history.models.common.Permission... 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 SetPermissionsChangeBuilder nextValue(
089            final com.commercetools.history.models.common.Permission... nextValue) {
090        this.nextValue = new ArrayList<>(Arrays.asList(nextValue));
091        return this;
092    }
093
094    /**
095     *  <p>Value after the change.</p>
096     * @param nextValue value to be set
097     * @return Builder
098     */
099
100    public SetPermissionsChangeBuilder nextValue(
101            final java.util.List<com.commercetools.history.models.common.Permission> nextValue) {
102        this.nextValue = nextValue;
103        return this;
104    }
105
106    /**
107     *  <p>Value after the change.</p>
108     * @param nextValue value to be set
109     * @return Builder
110     */
111
112    public SetPermissionsChangeBuilder plusNextValue(
113            final com.commercetools.history.models.common.Permission... nextValue) {
114        if (this.nextValue == null) {
115            this.nextValue = new ArrayList<>();
116        }
117        this.nextValue.addAll(Arrays.asList(nextValue));
118        return this;
119    }
120
121    /**
122     * value of change}
123     * @return change
124     */
125
126    public String getChange() {
127        return this.change;
128    }
129
130    /**
131     *  <p>Value before the change.</p>
132     * @return previousValue
133     */
134
135    public java.util.List<com.commercetools.history.models.common.Permission> getPreviousValue() {
136        return this.previousValue;
137    }
138
139    /**
140     *  <p>Value after the change.</p>
141     * @return nextValue
142     */
143
144    public java.util.List<com.commercetools.history.models.common.Permission> getNextValue() {
145        return this.nextValue;
146    }
147
148    /**
149     * builds SetPermissionsChange with checking for non-null required values
150     * @return SetPermissionsChange
151     */
152    public SetPermissionsChange build() {
153        Objects.requireNonNull(change, SetPermissionsChange.class + ": change is missing");
154        Objects.requireNonNull(previousValue, SetPermissionsChange.class + ": previousValue is missing");
155        Objects.requireNonNull(nextValue, SetPermissionsChange.class + ": nextValue is missing");
156        return new SetPermissionsChangeImpl(change, previousValue, nextValue);
157    }
158
159    /**
160     * builds SetPermissionsChange without checking for non-null required values
161     * @return SetPermissionsChange
162     */
163    public SetPermissionsChange buildUnchecked() {
164        return new SetPermissionsChangeImpl(change, previousValue, nextValue);
165    }
166
167    /**
168     * factory method for an instance of SetPermissionsChangeBuilder
169     * @return builder
170     */
171    public static SetPermissionsChangeBuilder of() {
172        return new SetPermissionsChangeBuilder();
173    }
174
175    /**
176     * create builder for SetPermissionsChange instance
177     * @param template instance with prefilled values for the builder
178     * @return builder
179     */
180    public static SetPermissionsChangeBuilder of(final SetPermissionsChange template) {
181        SetPermissionsChangeBuilder builder = new SetPermissionsChangeBuilder();
182        builder.change = template.getChange();
183        builder.previousValue = template.getPreviousValue();
184        builder.nextValue = template.getNextValue();
185        return builder;
186    }
187
188}