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