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 * SetDeliveryAddressChangeBuilder
012 * <hr>
013 * Example to create an instance using the builder pattern
014 * <div class=code-example>
015 * <pre><code class='java'>
016 *     SetDeliveryAddressChange setDeliveryAddressChange = SetDeliveryAddressChange.builder()
017 *             .change("{change}")
018 *             .previousValue(previousValueBuilder -> previousValueBuilder)
019 *             .nextValue(nextValueBuilder -> nextValueBuilder)
020 *             .deliveryId("{deliveryId}")
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 SetDeliveryAddressChangeBuilder implements Builder<SetDeliveryAddressChange> {
027
028    private String change;
029
030    private com.commercetools.history.models.common.Address previousValue;
031
032    private com.commercetools.history.models.common.Address nextValue;
033
034    private String deliveryId;
035
036    /**
037     * set the value to the change
038     * @param change value to be set
039     * @return Builder
040     */
041
042    public SetDeliveryAddressChangeBuilder 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 SetDeliveryAddressChangeBuilder previousValue(
054            Function<com.commercetools.history.models.common.AddressBuilder, com.commercetools.history.models.common.AddressBuilder> builder) {
055        this.previousValue = builder.apply(com.commercetools.history.models.common.AddressBuilder.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 SetDeliveryAddressChangeBuilder withPreviousValue(
066            Function<com.commercetools.history.models.common.AddressBuilder, com.commercetools.history.models.common.Address> builder) {
067        this.previousValue = builder.apply(com.commercetools.history.models.common.AddressBuilder.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 SetDeliveryAddressChangeBuilder previousValue(
078            final com.commercetools.history.models.common.Address 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 SetDeliveryAddressChangeBuilder nextValue(
090            Function<com.commercetools.history.models.common.AddressBuilder, com.commercetools.history.models.common.AddressBuilder> builder) {
091        this.nextValue = builder.apply(com.commercetools.history.models.common.AddressBuilder.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 SetDeliveryAddressChangeBuilder withNextValue(
102            Function<com.commercetools.history.models.common.AddressBuilder, com.commercetools.history.models.common.Address> builder) {
103        this.nextValue = builder.apply(com.commercetools.history.models.common.AddressBuilder.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 SetDeliveryAddressChangeBuilder nextValue(final com.commercetools.history.models.common.Address nextValue) {
114        this.nextValue = nextValue;
115        return this;
116    }
117
118    /**
119     *  <p><code>id</code> of the updated Delivery.</p>
120     * @param deliveryId value to be set
121     * @return Builder
122     */
123
124    public SetDeliveryAddressChangeBuilder deliveryId(final String deliveryId) {
125        this.deliveryId = deliveryId;
126        return this;
127    }
128
129    /**
130     * value of change}
131     * @return change
132     */
133
134    public String getChange() {
135        return this.change;
136    }
137
138    /**
139     *  <p>Value before the change.</p>
140     * @return previousValue
141     */
142
143    public com.commercetools.history.models.common.Address getPreviousValue() {
144        return this.previousValue;
145    }
146
147    /**
148     *  <p>Value after the change.</p>
149     * @return nextValue
150     */
151
152    public com.commercetools.history.models.common.Address getNextValue() {
153        return this.nextValue;
154    }
155
156    /**
157     *  <p><code>id</code> of the updated Delivery.</p>
158     * @return deliveryId
159     */
160
161    public String getDeliveryId() {
162        return this.deliveryId;
163    }
164
165    /**
166     * builds SetDeliveryAddressChange with checking for non-null required values
167     * @return SetDeliveryAddressChange
168     */
169    public SetDeliveryAddressChange build() {
170        Objects.requireNonNull(change, SetDeliveryAddressChange.class + ": change is missing");
171        Objects.requireNonNull(previousValue, SetDeliveryAddressChange.class + ": previousValue is missing");
172        Objects.requireNonNull(nextValue, SetDeliveryAddressChange.class + ": nextValue is missing");
173        Objects.requireNonNull(deliveryId, SetDeliveryAddressChange.class + ": deliveryId is missing");
174        return new SetDeliveryAddressChangeImpl(change, previousValue, nextValue, deliveryId);
175    }
176
177    /**
178     * builds SetDeliveryAddressChange without checking for non-null required values
179     * @return SetDeliveryAddressChange
180     */
181    public SetDeliveryAddressChange buildUnchecked() {
182        return new SetDeliveryAddressChangeImpl(change, previousValue, nextValue, deliveryId);
183    }
184
185    /**
186     * factory method for an instance of SetDeliveryAddressChangeBuilder
187     * @return builder
188     */
189    public static SetDeliveryAddressChangeBuilder of() {
190        return new SetDeliveryAddressChangeBuilder();
191    }
192
193    /**
194     * create builder for SetDeliveryAddressChange instance
195     * @param template instance with prefilled values for the builder
196     * @return builder
197     */
198    public static SetDeliveryAddressChangeBuilder of(final SetDeliveryAddressChange template) {
199        SetDeliveryAddressChangeBuilder builder = new SetDeliveryAddressChangeBuilder();
200        builder.change = template.getChange();
201        builder.previousValue = template.getPreviousValue();
202        builder.nextValue = template.getNextValue();
203        builder.deliveryId = template.getDeliveryId();
204        return builder;
205    }
206
207}