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 * SetShippingMethodChangeBuilder
012 * <hr>
013 * Example to create an instance using the builder pattern
014 * <div class=code-example>
015 * <pre><code class='java'>
016 *     SetShippingMethodChange setShippingMethodChange = SetShippingMethodChange.builder()
017 *             .change("{change}")
018 *             .previousValue(previousValueBuilder -> previousValueBuilder)
019 *             .nextValue(nextValueBuilder -> nextValueBuilder)
020 *             .build()
021 * </code></pre>
022 * </div>
023 */
024@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
025public class SetShippingMethodChangeBuilder implements Builder<SetShippingMethodChange> {
026
027    private String change;
028
029    private com.commercetools.history.models.change_value.ShippingMethodChangeValue previousValue;
030
031    private com.commercetools.history.models.change_value.ShippingMethodChangeValue nextValue;
032
033    /**
034     * set the value to the change
035     * @param change value to be set
036     * @return Builder
037     */
038
039    public SetShippingMethodChangeBuilder change(final String change) {
040        this.change = change;
041        return this;
042    }
043
044    /**
045     *  <p>Value before the change.</p>
046     * @param builder function to build the previousValue value
047     * @return Builder
048     */
049
050    public SetShippingMethodChangeBuilder previousValue(
051            Function<com.commercetools.history.models.change_value.ShippingMethodChangeValueBuilder, com.commercetools.history.models.change_value.ShippingMethodChangeValueBuilder> builder) {
052        this.previousValue = builder
053                .apply(com.commercetools.history.models.change_value.ShippingMethodChangeValueBuilder.of())
054                .build();
055        return this;
056    }
057
058    /**
059     *  <p>Value before the change.</p>
060     * @param builder function to build the previousValue value
061     * @return Builder
062     */
063
064    public SetShippingMethodChangeBuilder withPreviousValue(
065            Function<com.commercetools.history.models.change_value.ShippingMethodChangeValueBuilder, com.commercetools.history.models.change_value.ShippingMethodChangeValue> builder) {
066        this.previousValue = builder
067                .apply(com.commercetools.history.models.change_value.ShippingMethodChangeValueBuilder.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 SetShippingMethodChangeBuilder previousValue(
078            final com.commercetools.history.models.change_value.ShippingMethodChangeValue 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 SetShippingMethodChangeBuilder nextValue(
090            Function<com.commercetools.history.models.change_value.ShippingMethodChangeValueBuilder, com.commercetools.history.models.change_value.ShippingMethodChangeValueBuilder> builder) {
091        this.nextValue = builder
092                .apply(com.commercetools.history.models.change_value.ShippingMethodChangeValueBuilder.of())
093                .build();
094        return this;
095    }
096
097    /**
098     *  <p>Value after the change.</p>
099     * @param builder function to build the nextValue value
100     * @return Builder
101     */
102
103    public SetShippingMethodChangeBuilder withNextValue(
104            Function<com.commercetools.history.models.change_value.ShippingMethodChangeValueBuilder, com.commercetools.history.models.change_value.ShippingMethodChangeValue> builder) {
105        this.nextValue = builder
106                .apply(com.commercetools.history.models.change_value.ShippingMethodChangeValueBuilder.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 SetShippingMethodChangeBuilder nextValue(
117            final com.commercetools.history.models.change_value.ShippingMethodChangeValue nextValue) {
118        this.nextValue = nextValue;
119        return this;
120    }
121
122    /**
123     * value of change}
124     * @return change
125     */
126
127    public String getChange() {
128        return this.change;
129    }
130
131    /**
132     *  <p>Value before the change.</p>
133     * @return previousValue
134     */
135
136    public com.commercetools.history.models.change_value.ShippingMethodChangeValue getPreviousValue() {
137        return this.previousValue;
138    }
139
140    /**
141     *  <p>Value after the change.</p>
142     * @return nextValue
143     */
144
145    public com.commercetools.history.models.change_value.ShippingMethodChangeValue getNextValue() {
146        return this.nextValue;
147    }
148
149    /**
150     * builds SetShippingMethodChange with checking for non-null required values
151     * @return SetShippingMethodChange
152     */
153    public SetShippingMethodChange build() {
154        Objects.requireNonNull(change, SetShippingMethodChange.class + ": change is missing");
155        Objects.requireNonNull(previousValue, SetShippingMethodChange.class + ": previousValue is missing");
156        Objects.requireNonNull(nextValue, SetShippingMethodChange.class + ": nextValue is missing");
157        return new SetShippingMethodChangeImpl(change, previousValue, nextValue);
158    }
159
160    /**
161     * builds SetShippingMethodChange without checking for non-null required values
162     * @return SetShippingMethodChange
163     */
164    public SetShippingMethodChange buildUnchecked() {
165        return new SetShippingMethodChangeImpl(change, previousValue, nextValue);
166    }
167
168    /**
169     * factory method for an instance of SetShippingMethodChangeBuilder
170     * @return builder
171     */
172    public static SetShippingMethodChangeBuilder of() {
173        return new SetShippingMethodChangeBuilder();
174    }
175
176    /**
177     * create builder for SetShippingMethodChange instance
178     * @param template instance with prefilled values for the builder
179     * @return builder
180     */
181    public static SetShippingMethodChangeBuilder of(final SetShippingMethodChange template) {
182        SetShippingMethodChangeBuilder builder = new SetShippingMethodChangeBuilder();
183        builder.change = template.getChange();
184        builder.previousValue = template.getPreviousValue();
185        builder.nextValue = template.getNextValue();
186        return builder;
187    }
188
189}