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 * SetCustomLineItemMoneyChangeBuilder
012 * <hr>
013 * Example to create an instance using the builder pattern
014 * <div class=code-example>
015 * <pre><code class='java'>
016 *     SetCustomLineItemMoneyChange setCustomLineItemMoneyChange = SetCustomLineItemMoneyChange.builder()
017 *             .change("{change}")
018 *             .previousValue(previousValueBuilder -> previousValueBuilder)
019 *             .nextValue(nextValueBuilder -> nextValueBuilder)
020 *             .customLineItem(customLineItemBuilder -> customLineItemBuilder)
021 *             .customLineItemId("{customLineItemId}")
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 SetCustomLineItemMoneyChangeBuilder implements Builder<SetCustomLineItemMoneyChange> {
028
029    private String change;
030
031    private com.commercetools.history.models.common.Money previousValue;
032
033    private com.commercetools.history.models.common.Money nextValue;
034
035    private com.commercetools.history.models.common.LocalizedString customLineItem;
036
037    private String customLineItemId;
038
039    /**
040     * set the value to the change
041     * @param change value to be set
042     * @return Builder
043     */
044
045    public SetCustomLineItemMoneyChangeBuilder 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 SetCustomLineItemMoneyChangeBuilder previousValue(
057            Function<com.commercetools.history.models.common.MoneyBuilder, com.commercetools.history.models.common.MoneyBuilder> builder) {
058        this.previousValue = builder.apply(com.commercetools.history.models.common.MoneyBuilder.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 SetCustomLineItemMoneyChangeBuilder withPreviousValue(
069            Function<com.commercetools.history.models.common.MoneyBuilder, com.commercetools.history.models.common.Money> builder) {
070        this.previousValue = builder.apply(com.commercetools.history.models.common.MoneyBuilder.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 SetCustomLineItemMoneyChangeBuilder previousValue(
081            final com.commercetools.history.models.common.Money 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 SetCustomLineItemMoneyChangeBuilder nextValue(
093            Function<com.commercetools.history.models.common.MoneyBuilder, com.commercetools.history.models.common.MoneyBuilder> builder) {
094        this.nextValue = builder.apply(com.commercetools.history.models.common.MoneyBuilder.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 SetCustomLineItemMoneyChangeBuilder withNextValue(
105            Function<com.commercetools.history.models.common.MoneyBuilder, com.commercetools.history.models.common.Money> builder) {
106        this.nextValue = builder.apply(com.commercetools.history.models.common.MoneyBuilder.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 SetCustomLineItemMoneyChangeBuilder nextValue(
117            final com.commercetools.history.models.common.Money nextValue) {
118        this.nextValue = nextValue;
119        return this;
120    }
121
122    /**
123     *  <p>Name of the updated CustomLineItem.</p>
124     * @param builder function to build the customLineItem value
125     * @return Builder
126     */
127
128    public SetCustomLineItemMoneyChangeBuilder customLineItem(
129            Function<com.commercetools.history.models.common.LocalizedStringBuilder, com.commercetools.history.models.common.LocalizedStringBuilder> builder) {
130        this.customLineItem = builder.apply(com.commercetools.history.models.common.LocalizedStringBuilder.of())
131                .build();
132        return this;
133    }
134
135    /**
136     *  <p>Name of the updated CustomLineItem.</p>
137     * @param builder function to build the customLineItem value
138     * @return Builder
139     */
140
141    public SetCustomLineItemMoneyChangeBuilder withCustomLineItem(
142            Function<com.commercetools.history.models.common.LocalizedStringBuilder, com.commercetools.history.models.common.LocalizedString> builder) {
143        this.customLineItem = builder.apply(com.commercetools.history.models.common.LocalizedStringBuilder.of());
144        return this;
145    }
146
147    /**
148     *  <p>Name of the updated CustomLineItem.</p>
149     * @param customLineItem value to be set
150     * @return Builder
151     */
152
153    public SetCustomLineItemMoneyChangeBuilder customLineItem(
154            final com.commercetools.history.models.common.LocalizedString customLineItem) {
155        this.customLineItem = customLineItem;
156        return this;
157    }
158
159    /**
160     *  <p><code>id</code> of the updated CustomLineItem.</p>
161     * @param customLineItemId value to be set
162     * @return Builder
163     */
164
165    public SetCustomLineItemMoneyChangeBuilder customLineItemId(final String customLineItemId) {
166        this.customLineItemId = customLineItemId;
167        return this;
168    }
169
170    /**
171     * value of change}
172     * @return change
173     */
174
175    public String getChange() {
176        return this.change;
177    }
178
179    /**
180     *  <p>Value before the change.</p>
181     * @return previousValue
182     */
183
184    public com.commercetools.history.models.common.Money getPreviousValue() {
185        return this.previousValue;
186    }
187
188    /**
189     *  <p>Value after the change.</p>
190     * @return nextValue
191     */
192
193    public com.commercetools.history.models.common.Money getNextValue() {
194        return this.nextValue;
195    }
196
197    /**
198     *  <p>Name of the updated CustomLineItem.</p>
199     * @return customLineItem
200     */
201
202    public com.commercetools.history.models.common.LocalizedString getCustomLineItem() {
203        return this.customLineItem;
204    }
205
206    /**
207     *  <p><code>id</code> of the updated CustomLineItem.</p>
208     * @return customLineItemId
209     */
210
211    public String getCustomLineItemId() {
212        return this.customLineItemId;
213    }
214
215    /**
216     * builds SetCustomLineItemMoneyChange with checking for non-null required values
217     * @return SetCustomLineItemMoneyChange
218     */
219    public SetCustomLineItemMoneyChange build() {
220        Objects.requireNonNull(change, SetCustomLineItemMoneyChange.class + ": change is missing");
221        Objects.requireNonNull(previousValue, SetCustomLineItemMoneyChange.class + ": previousValue is missing");
222        Objects.requireNonNull(nextValue, SetCustomLineItemMoneyChange.class + ": nextValue is missing");
223        Objects.requireNonNull(customLineItem, SetCustomLineItemMoneyChange.class + ": customLineItem is missing");
224        Objects.requireNonNull(customLineItemId, SetCustomLineItemMoneyChange.class + ": customLineItemId is missing");
225        return new SetCustomLineItemMoneyChangeImpl(change, previousValue, nextValue, customLineItem, customLineItemId);
226    }
227
228    /**
229     * builds SetCustomLineItemMoneyChange without checking for non-null required values
230     * @return SetCustomLineItemMoneyChange
231     */
232    public SetCustomLineItemMoneyChange buildUnchecked() {
233        return new SetCustomLineItemMoneyChangeImpl(change, previousValue, nextValue, customLineItem, customLineItemId);
234    }
235
236    /**
237     * factory method for an instance of SetCustomLineItemMoneyChangeBuilder
238     * @return builder
239     */
240    public static SetCustomLineItemMoneyChangeBuilder of() {
241        return new SetCustomLineItemMoneyChangeBuilder();
242    }
243
244    /**
245     * create builder for SetCustomLineItemMoneyChange instance
246     * @param template instance with prefilled values for the builder
247     * @return builder
248     */
249    public static SetCustomLineItemMoneyChangeBuilder of(final SetCustomLineItemMoneyChange template) {
250        SetCustomLineItemMoneyChangeBuilder builder = new SetCustomLineItemMoneyChangeBuilder();
251        builder.change = template.getChange();
252        builder.previousValue = template.getPreviousValue();
253        builder.nextValue = template.getNextValue();
254        builder.customLineItem = template.getCustomLineItem();
255        builder.customLineItemId = template.getCustomLineItemId();
256        return builder;
257    }
258
259}