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