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