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 * SetCustomShippingMethodChangeBuilder
012 * <hr>
013 * Example to create an instance using the builder pattern
014 * <div class=code-example>
015 * <pre><code class='java'>
016 *     SetCustomShippingMethodChange setCustomShippingMethodChange = SetCustomShippingMethodChange.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 SetCustomShippingMethodChangeBuilder implements Builder<SetCustomShippingMethodChange> {
026
027    private String change;
028
029    private com.commercetools.history.models.change_value.CustomShippingMethodChangeValue previousValue;
030
031    private com.commercetools.history.models.change_value.CustomShippingMethodChangeValue nextValue;
032
033    /**
034     * set the value to the change
035     * @param change value to be set
036     * @return Builder
037     */
038
039    public SetCustomShippingMethodChangeBuilder 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 SetCustomShippingMethodChangeBuilder previousValue(
051            Function<com.commercetools.history.models.change_value.CustomShippingMethodChangeValueBuilder, com.commercetools.history.models.change_value.CustomShippingMethodChangeValueBuilder> builder) {
052        this.previousValue = builder
053                .apply(com.commercetools.history.models.change_value.CustomShippingMethodChangeValueBuilder.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 SetCustomShippingMethodChangeBuilder withPreviousValue(
065            Function<com.commercetools.history.models.change_value.CustomShippingMethodChangeValueBuilder, com.commercetools.history.models.change_value.CustomShippingMethodChangeValue> builder) {
066        this.previousValue = builder
067                .apply(com.commercetools.history.models.change_value.CustomShippingMethodChangeValueBuilder.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 SetCustomShippingMethodChangeBuilder previousValue(
078            final com.commercetools.history.models.change_value.CustomShippingMethodChangeValue 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 SetCustomShippingMethodChangeBuilder nextValue(
090            Function<com.commercetools.history.models.change_value.CustomShippingMethodChangeValueBuilder, com.commercetools.history.models.change_value.CustomShippingMethodChangeValueBuilder> builder) {
091        this.nextValue = builder
092                .apply(com.commercetools.history.models.change_value.CustomShippingMethodChangeValueBuilder.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 SetCustomShippingMethodChangeBuilder withNextValue(
104            Function<com.commercetools.history.models.change_value.CustomShippingMethodChangeValueBuilder, com.commercetools.history.models.change_value.CustomShippingMethodChangeValue> builder) {
105        this.nextValue = builder
106                .apply(com.commercetools.history.models.change_value.CustomShippingMethodChangeValueBuilder.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 SetCustomShippingMethodChangeBuilder nextValue(
117            final com.commercetools.history.models.change_value.CustomShippingMethodChangeValue 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.CustomShippingMethodChangeValue 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.CustomShippingMethodChangeValue getNextValue() {
146        return this.nextValue;
147    }
148
149    /**
150     * builds SetCustomShippingMethodChange with checking for non-null required values
151     * @return SetCustomShippingMethodChange
152     */
153    public SetCustomShippingMethodChange build() {
154        Objects.requireNonNull(change, SetCustomShippingMethodChange.class + ": change is missing");
155        Objects.requireNonNull(previousValue, SetCustomShippingMethodChange.class + ": previousValue is missing");
156        Objects.requireNonNull(nextValue, SetCustomShippingMethodChange.class + ": nextValue is missing");
157        return new SetCustomShippingMethodChangeImpl(change, previousValue, nextValue);
158    }
159
160    /**
161     * builds SetCustomShippingMethodChange without checking for non-null required values
162     * @return SetCustomShippingMethodChange
163     */
164    public SetCustomShippingMethodChange buildUnchecked() {
165        return new SetCustomShippingMethodChangeImpl(change, previousValue, nextValue);
166    }
167
168    /**
169     * factory method for an instance of SetCustomShippingMethodChangeBuilder
170     * @return builder
171     */
172    public static SetCustomShippingMethodChangeBuilder of() {
173        return new SetCustomShippingMethodChangeBuilder();
174    }
175
176    /**
177     * create builder for SetCustomShippingMethodChange instance
178     * @param template instance with prefilled values for the builder
179     * @return builder
180     */
181    public static SetCustomShippingMethodChangeBuilder of(final SetCustomShippingMethodChange template) {
182        SetCustomShippingMethodChangeBuilder builder = new SetCustomShippingMethodChangeBuilder();
183        builder.change = template.getChange();
184        builder.previousValue = template.getPreviousValue();
185        builder.nextValue = template.getNextValue();
186        return builder;
187    }
188
189}