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 * ChangeMasterVariantChangeBuilder
012 * <hr>
013 * Example to create an instance using the builder pattern
014 * <div class=code-example>
015 * <pre><code class='java'>
016 *     ChangeMasterVariantChange changeMasterVariantChange = ChangeMasterVariantChange.builder()
017 *             .change("{change}")
018 *             .previousValue(previousValueBuilder -> previousValueBuilder)
019 *             .nextValue(nextValueBuilder -> nextValueBuilder)
020 *             .catalogData("{catalogData}")
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 ChangeMasterVariantChangeBuilder implements Builder<ChangeMasterVariantChange> {
027
028    private String change;
029
030    private com.commercetools.history.models.common.Variant previousValue;
031
032    private com.commercetools.history.models.common.Variant nextValue;
033
034    private String catalogData;
035
036    /**
037     * set the value to the change
038     * @param change value to be set
039     * @return Builder
040     */
041
042    public ChangeMasterVariantChangeBuilder change(final String change) {
043        this.change = change;
044        return this;
045    }
046
047    /**
048     *  <p>Value before the change.</p>
049     * @param builder function to build the previousValue value
050     * @return Builder
051     */
052
053    public ChangeMasterVariantChangeBuilder previousValue(
054            Function<com.commercetools.history.models.common.VariantBuilder, com.commercetools.history.models.common.VariantBuilder> builder) {
055        this.previousValue = builder.apply(com.commercetools.history.models.common.VariantBuilder.of()).build();
056        return this;
057    }
058
059    /**
060     *  <p>Value before the change.</p>
061     * @param builder function to build the previousValue value
062     * @return Builder
063     */
064
065    public ChangeMasterVariantChangeBuilder withPreviousValue(
066            Function<com.commercetools.history.models.common.VariantBuilder, com.commercetools.history.models.common.Variant> builder) {
067        this.previousValue = builder.apply(com.commercetools.history.models.common.VariantBuilder.of());
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 ChangeMasterVariantChangeBuilder previousValue(
078            final com.commercetools.history.models.common.Variant previousValue) {
079        this.previousValue = previousValue;
080        return this;
081    }
082
083    /**
084     *  <p>Value after the change.</p>
085     * @param builder function to build the nextValue value
086     * @return Builder
087     */
088
089    public ChangeMasterVariantChangeBuilder nextValue(
090            Function<com.commercetools.history.models.common.VariantBuilder, com.commercetools.history.models.common.VariantBuilder> builder) {
091        this.nextValue = builder.apply(com.commercetools.history.models.common.VariantBuilder.of()).build();
092        return this;
093    }
094
095    /**
096     *  <p>Value after the change.</p>
097     * @param builder function to build the nextValue value
098     * @return Builder
099     */
100
101    public ChangeMasterVariantChangeBuilder withNextValue(
102            Function<com.commercetools.history.models.common.VariantBuilder, com.commercetools.history.models.common.Variant> builder) {
103        this.nextValue = builder.apply(com.commercetools.history.models.common.VariantBuilder.of());
104        return this;
105    }
106
107    /**
108     *  <p>Value after the change.</p>
109     * @param nextValue value to be set
110     * @return Builder
111     */
112
113    public ChangeMasterVariantChangeBuilder nextValue(final com.commercetools.history.models.common.Variant nextValue) {
114        this.nextValue = nextValue;
115        return this;
116    }
117
118    /**
119     *  <ul>
120     *   <li><code>staged</code>, if the staged ProductCatalogData was updated.</li>
121     *   <li><code>current</code>, if the current ProductCatalogData was updated.</li>
122     *  </ul>
123     * @param catalogData value to be set
124     * @return Builder
125     */
126
127    public ChangeMasterVariantChangeBuilder catalogData(final String catalogData) {
128        this.catalogData = catalogData;
129        return this;
130    }
131
132    /**
133     * value of change}
134     * @return change
135     */
136
137    public String getChange() {
138        return this.change;
139    }
140
141    /**
142     *  <p>Value before the change.</p>
143     * @return previousValue
144     */
145
146    public com.commercetools.history.models.common.Variant getPreviousValue() {
147        return this.previousValue;
148    }
149
150    /**
151     *  <p>Value after the change.</p>
152     * @return nextValue
153     */
154
155    public com.commercetools.history.models.common.Variant getNextValue() {
156        return this.nextValue;
157    }
158
159    /**
160     *  <ul>
161     *   <li><code>staged</code>, if the staged ProductCatalogData was updated.</li>
162     *   <li><code>current</code>, if the current ProductCatalogData was updated.</li>
163     *  </ul>
164     * @return catalogData
165     */
166
167    public String getCatalogData() {
168        return this.catalogData;
169    }
170
171    /**
172     * builds ChangeMasterVariantChange with checking for non-null required values
173     * @return ChangeMasterVariantChange
174     */
175    public ChangeMasterVariantChange build() {
176        Objects.requireNonNull(change, ChangeMasterVariantChange.class + ": change is missing");
177        Objects.requireNonNull(previousValue, ChangeMasterVariantChange.class + ": previousValue is missing");
178        Objects.requireNonNull(nextValue, ChangeMasterVariantChange.class + ": nextValue is missing");
179        Objects.requireNonNull(catalogData, ChangeMasterVariantChange.class + ": catalogData is missing");
180        return new ChangeMasterVariantChangeImpl(change, previousValue, nextValue, catalogData);
181    }
182
183    /**
184     * builds ChangeMasterVariantChange without checking for non-null required values
185     * @return ChangeMasterVariantChange
186     */
187    public ChangeMasterVariantChange buildUnchecked() {
188        return new ChangeMasterVariantChangeImpl(change, previousValue, nextValue, catalogData);
189    }
190
191    /**
192     * factory method for an instance of ChangeMasterVariantChangeBuilder
193     * @return builder
194     */
195    public static ChangeMasterVariantChangeBuilder of() {
196        return new ChangeMasterVariantChangeBuilder();
197    }
198
199    /**
200     * create builder for ChangeMasterVariantChange instance
201     * @param template instance with prefilled values for the builder
202     * @return builder
203     */
204    public static ChangeMasterVariantChangeBuilder of(final ChangeMasterVariantChange template) {
205        ChangeMasterVariantChangeBuilder builder = new ChangeMasterVariantChangeBuilder();
206        builder.change = template.getChange();
207        builder.previousValue = template.getPreviousValue();
208        builder.nextValue = template.getNextValue();
209        builder.catalogData = template.getCatalogData();
210        return builder;
211    }
212
213}