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