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