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 * SetShippingMethodTaxAmountChangeBuilder
012 * <hr>
013 * Example to create an instance using the builder pattern
014 * <div class=code-example>
015 * <pre><code class='java'>
016 *     SetShippingMethodTaxAmountChange setShippingMethodTaxAmountChange = SetShippingMethodTaxAmountChange.builder()
017 *             .change("{change}")
018 *             .previousValue(previousValueBuilder -> previousValueBuilder)
019 *             .nextValue(nextValueBuilder -> nextValueBuilder)
020 *             .taxMode(TaxMode.PLATFORM)
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 SetShippingMethodTaxAmountChangeBuilder implements Builder<SetShippingMethodTaxAmountChange> {
027
028    private String change;
029
030    private com.commercetools.history.models.change_value.ShippingMethodTaxAmountChangeValue previousValue;
031
032    private com.commercetools.history.models.change_value.ShippingMethodTaxAmountChangeValue nextValue;
033
034    private com.commercetools.history.models.common.TaxMode taxMode;
035
036    /**
037     * set the value to the change
038     * @param change value to be set
039     * @return Builder
040     */
041
042    public SetShippingMethodTaxAmountChangeBuilder 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 SetShippingMethodTaxAmountChangeBuilder previousValue(
054            Function<com.commercetools.history.models.change_value.ShippingMethodTaxAmountChangeValueBuilder, com.commercetools.history.models.change_value.ShippingMethodTaxAmountChangeValueBuilder> builder) {
055        this.previousValue = builder
056                .apply(com.commercetools.history.models.change_value.ShippingMethodTaxAmountChangeValueBuilder.of())
057                .build();
058        return this;
059    }
060
061    /**
062     *  <p>Value before the change.</p>
063     * @param builder function to build the previousValue value
064     * @return Builder
065     */
066
067    public SetShippingMethodTaxAmountChangeBuilder withPreviousValue(
068            Function<com.commercetools.history.models.change_value.ShippingMethodTaxAmountChangeValueBuilder, com.commercetools.history.models.change_value.ShippingMethodTaxAmountChangeValue> builder) {
069        this.previousValue = builder
070                .apply(com.commercetools.history.models.change_value.ShippingMethodTaxAmountChangeValueBuilder.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 SetShippingMethodTaxAmountChangeBuilder previousValue(
081            final com.commercetools.history.models.change_value.ShippingMethodTaxAmountChangeValue 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 SetShippingMethodTaxAmountChangeBuilder nextValue(
093            Function<com.commercetools.history.models.change_value.ShippingMethodTaxAmountChangeValueBuilder, com.commercetools.history.models.change_value.ShippingMethodTaxAmountChangeValueBuilder> builder) {
094        this.nextValue = builder
095                .apply(com.commercetools.history.models.change_value.ShippingMethodTaxAmountChangeValueBuilder.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 SetShippingMethodTaxAmountChangeBuilder withNextValue(
107            Function<com.commercetools.history.models.change_value.ShippingMethodTaxAmountChangeValueBuilder, com.commercetools.history.models.change_value.ShippingMethodTaxAmountChangeValue> builder) {
108        this.nextValue = builder
109                .apply(com.commercetools.history.models.change_value.ShippingMethodTaxAmountChangeValueBuilder.of());
110        return this;
111    }
112
113    /**
114     *  <p>Value after the change.</p>
115     * @param nextValue value to be set
116     * @return Builder
117     */
118
119    public SetShippingMethodTaxAmountChangeBuilder nextValue(
120            final com.commercetools.history.models.change_value.ShippingMethodTaxAmountChangeValue nextValue) {
121        this.nextValue = nextValue;
122        return this;
123    }
124
125    /**
126     *  <p><code>"ExternalAmount"</code></p>
127     * @param taxMode value to be set
128     * @return Builder
129     */
130
131    public SetShippingMethodTaxAmountChangeBuilder taxMode(
132            final com.commercetools.history.models.common.TaxMode taxMode) {
133        this.taxMode = taxMode;
134        return this;
135    }
136
137    /**
138     * value of change}
139     * @return change
140     */
141
142    public String getChange() {
143        return this.change;
144    }
145
146    /**
147     *  <p>Value before the change.</p>
148     * @return previousValue
149     */
150
151    public com.commercetools.history.models.change_value.ShippingMethodTaxAmountChangeValue getPreviousValue() {
152        return this.previousValue;
153    }
154
155    /**
156     *  <p>Value after the change.</p>
157     * @return nextValue
158     */
159
160    public com.commercetools.history.models.change_value.ShippingMethodTaxAmountChangeValue getNextValue() {
161        return this.nextValue;
162    }
163
164    /**
165     *  <p><code>"ExternalAmount"</code></p>
166     * @return taxMode
167     */
168
169    public com.commercetools.history.models.common.TaxMode getTaxMode() {
170        return this.taxMode;
171    }
172
173    /**
174     * builds SetShippingMethodTaxAmountChange with checking for non-null required values
175     * @return SetShippingMethodTaxAmountChange
176     */
177    public SetShippingMethodTaxAmountChange build() {
178        Objects.requireNonNull(change, SetShippingMethodTaxAmountChange.class + ": change is missing");
179        Objects.requireNonNull(previousValue, SetShippingMethodTaxAmountChange.class + ": previousValue is missing");
180        Objects.requireNonNull(nextValue, SetShippingMethodTaxAmountChange.class + ": nextValue is missing");
181        Objects.requireNonNull(taxMode, SetShippingMethodTaxAmountChange.class + ": taxMode is missing");
182        return new SetShippingMethodTaxAmountChangeImpl(change, previousValue, nextValue, taxMode);
183    }
184
185    /**
186     * builds SetShippingMethodTaxAmountChange without checking for non-null required values
187     * @return SetShippingMethodTaxAmountChange
188     */
189    public SetShippingMethodTaxAmountChange buildUnchecked() {
190        return new SetShippingMethodTaxAmountChangeImpl(change, previousValue, nextValue, taxMode);
191    }
192
193    /**
194     * factory method for an instance of SetShippingMethodTaxAmountChangeBuilder
195     * @return builder
196     */
197    public static SetShippingMethodTaxAmountChangeBuilder of() {
198        return new SetShippingMethodTaxAmountChangeBuilder();
199    }
200
201    /**
202     * create builder for SetShippingMethodTaxAmountChange instance
203     * @param template instance with prefilled values for the builder
204     * @return builder
205     */
206    public static SetShippingMethodTaxAmountChangeBuilder of(final SetShippingMethodTaxAmountChange template) {
207        SetShippingMethodTaxAmountChangeBuilder builder = new SetShippingMethodTaxAmountChangeBuilder();
208        builder.change = template.getChange();
209        builder.previousValue = template.getPreviousValue();
210        builder.nextValue = template.getNextValue();
211        builder.taxMode = template.getTaxMode();
212        return builder;
213    }
214
215}