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