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 * SetLineItemDistributionChannelChangeBuilder
012 * <hr>
013 * Example to create an instance using the builder pattern
014 * <div class=code-example>
015 * <pre><code class='java'>
016 *     SetLineItemDistributionChannelChange setLineItemDistributionChannelChange = SetLineItemDistributionChannelChange.builder()
017 *             .change("{change}")
018 *             .previousValue(previousValueBuilder -> previousValueBuilder)
019 *             .nextValue(nextValueBuilder -> nextValueBuilder)
020 *             .lineItem(lineItemBuilder -> lineItemBuilder)
021 *             .variant("{variant}")
022 *             .build()
023 * </code></pre>
024 * </div>
025 */
026@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
027public class SetLineItemDistributionChannelChangeBuilder implements Builder<SetLineItemDistributionChannelChange> {
028
029    private String change;
030
031    private com.commercetools.history.models.common.Reference previousValue;
032
033    private com.commercetools.history.models.common.Reference nextValue;
034
035    private com.commercetools.history.models.common.LocalizedString lineItem;
036
037    private String variant;
038
039    /**
040     * set the value to the change
041     * @param change value to be set
042     * @return Builder
043     */
044
045    public SetLineItemDistributionChannelChangeBuilder change(final String change) {
046        this.change = change;
047        return this;
048    }
049
050    /**
051     *  <p>Value before the change.</p>
052     * @param builder function to build the previousValue value
053     * @return Builder
054     */
055
056    public SetLineItemDistributionChannelChangeBuilder previousValue(
057            Function<com.commercetools.history.models.common.ReferenceBuilder, com.commercetools.history.models.common.ReferenceBuilder> builder) {
058        this.previousValue = builder.apply(com.commercetools.history.models.common.ReferenceBuilder.of()).build();
059        return this;
060    }
061
062    /**
063     *  <p>Value before the change.</p>
064     * @param builder function to build the previousValue value
065     * @return Builder
066     */
067
068    public SetLineItemDistributionChannelChangeBuilder withPreviousValue(
069            Function<com.commercetools.history.models.common.ReferenceBuilder, com.commercetools.history.models.common.Reference> builder) {
070        this.previousValue = builder.apply(com.commercetools.history.models.common.ReferenceBuilder.of());
071        return this;
072    }
073
074    /**
075     *  <p>Value before the change.</p>
076     * @param previousValue value to be set
077     * @return Builder
078     */
079
080    public SetLineItemDistributionChannelChangeBuilder previousValue(
081            final com.commercetools.history.models.common.Reference previousValue) {
082        this.previousValue = previousValue;
083        return this;
084    }
085
086    /**
087     *  <p>Value after the change.</p>
088     * @param builder function to build the nextValue value
089     * @return Builder
090     */
091
092    public SetLineItemDistributionChannelChangeBuilder nextValue(
093            Function<com.commercetools.history.models.common.ReferenceBuilder, com.commercetools.history.models.common.ReferenceBuilder> builder) {
094        this.nextValue = builder.apply(com.commercetools.history.models.common.ReferenceBuilder.of()).build();
095        return this;
096    }
097
098    /**
099     *  <p>Value after the change.</p>
100     * @param builder function to build the nextValue value
101     * @return Builder
102     */
103
104    public SetLineItemDistributionChannelChangeBuilder withNextValue(
105            Function<com.commercetools.history.models.common.ReferenceBuilder, com.commercetools.history.models.common.Reference> builder) {
106        this.nextValue = builder.apply(com.commercetools.history.models.common.ReferenceBuilder.of());
107        return this;
108    }
109
110    /**
111     *  <p>Value after the change.</p>
112     * @param nextValue value to be set
113     * @return Builder
114     */
115
116    public SetLineItemDistributionChannelChangeBuilder nextValue(
117            final com.commercetools.history.models.common.Reference nextValue) {
118        this.nextValue = nextValue;
119        return this;
120    }
121
122    /**
123     *  <p>Name of the Product the Line Item is based on.</p>
124     * @param builder function to build the lineItem value
125     * @return Builder
126     */
127
128    public SetLineItemDistributionChannelChangeBuilder lineItem(
129            Function<com.commercetools.history.models.common.LocalizedStringBuilder, com.commercetools.history.models.common.LocalizedStringBuilder> builder) {
130        this.lineItem = builder.apply(com.commercetools.history.models.common.LocalizedStringBuilder.of()).build();
131        return this;
132    }
133
134    /**
135     *  <p>Name of the Product the Line Item is based on.</p>
136     * @param builder function to build the lineItem value
137     * @return Builder
138     */
139
140    public SetLineItemDistributionChannelChangeBuilder withLineItem(
141            Function<com.commercetools.history.models.common.LocalizedStringBuilder, com.commercetools.history.models.common.LocalizedString> builder) {
142        this.lineItem = builder.apply(com.commercetools.history.models.common.LocalizedStringBuilder.of());
143        return this;
144    }
145
146    /**
147     *  <p>Name of the Product the Line Item is based on.</p>
148     * @param lineItem value to be set
149     * @return Builder
150     */
151
152    public SetLineItemDistributionChannelChangeBuilder lineItem(
153            final com.commercetools.history.models.common.LocalizedString lineItem) {
154        this.lineItem = lineItem;
155        return this;
156    }
157
158    /**
159     *  <p><code>sku</code> or <code>key</code> of the updated ProductVariant.</p>
160     * @param variant value to be set
161     * @return Builder
162     */
163
164    public SetLineItemDistributionChannelChangeBuilder variant(final String variant) {
165        this.variant = variant;
166        return this;
167    }
168
169    /**
170     * value of change}
171     * @return change
172     */
173
174    public String getChange() {
175        return this.change;
176    }
177
178    /**
179     *  <p>Value before the change.</p>
180     * @return previousValue
181     */
182
183    public com.commercetools.history.models.common.Reference getPreviousValue() {
184        return this.previousValue;
185    }
186
187    /**
188     *  <p>Value after the change.</p>
189     * @return nextValue
190     */
191
192    public com.commercetools.history.models.common.Reference getNextValue() {
193        return this.nextValue;
194    }
195
196    /**
197     *  <p>Name of the Product the Line Item is based on.</p>
198     * @return lineItem
199     */
200
201    public com.commercetools.history.models.common.LocalizedString getLineItem() {
202        return this.lineItem;
203    }
204
205    /**
206     *  <p><code>sku</code> or <code>key</code> of the updated ProductVariant.</p>
207     * @return variant
208     */
209
210    public String getVariant() {
211        return this.variant;
212    }
213
214    /**
215     * builds SetLineItemDistributionChannelChange with checking for non-null required values
216     * @return SetLineItemDistributionChannelChange
217     */
218    public SetLineItemDistributionChannelChange build() {
219        Objects.requireNonNull(change, SetLineItemDistributionChannelChange.class + ": change is missing");
220        Objects.requireNonNull(previousValue,
221            SetLineItemDistributionChannelChange.class + ": previousValue is missing");
222        Objects.requireNonNull(nextValue, SetLineItemDistributionChannelChange.class + ": nextValue is missing");
223        Objects.requireNonNull(lineItem, SetLineItemDistributionChannelChange.class + ": lineItem is missing");
224        Objects.requireNonNull(variant, SetLineItemDistributionChannelChange.class + ": variant is missing");
225        return new SetLineItemDistributionChannelChangeImpl(change, previousValue, nextValue, lineItem, variant);
226    }
227
228    /**
229     * builds SetLineItemDistributionChannelChange without checking for non-null required values
230     * @return SetLineItemDistributionChannelChange
231     */
232    public SetLineItemDistributionChannelChange buildUnchecked() {
233        return new SetLineItemDistributionChannelChangeImpl(change, previousValue, nextValue, lineItem, variant);
234    }
235
236    /**
237     * factory method for an instance of SetLineItemDistributionChannelChangeBuilder
238     * @return builder
239     */
240    public static SetLineItemDistributionChannelChangeBuilder of() {
241        return new SetLineItemDistributionChannelChangeBuilder();
242    }
243
244    /**
245     * create builder for SetLineItemDistributionChannelChange instance
246     * @param template instance with prefilled values for the builder
247     * @return builder
248     */
249    public static SetLineItemDistributionChannelChangeBuilder of(final SetLineItemDistributionChannelChange template) {
250        SetLineItemDistributionChannelChangeBuilder builder = new SetLineItemDistributionChannelChangeBuilder();
251        builder.change = template.getChange();
252        builder.previousValue = template.getPreviousValue();
253        builder.nextValue = template.getNextValue();
254        builder.lineItem = template.getLineItem();
255        builder.variant = template.getVariant();
256        return builder;
257    }
258
259}