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 * ChangePriceChangeBuilder
012 * <hr>
013 * Example to create an instance using the builder pattern
014 * <div class=code-example>
015 * <pre><code class='java'>
016 *     ChangePriceChange changePriceChange = ChangePriceChange.builder()
017 *             .change("{change}")
018 *             .previousValue(previousValueBuilder -> previousValueBuilder)
019 *             .nextValue(nextValueBuilder -> nextValueBuilder)
020 *             .catalogData("{catalogData}")
021 *             .priceId("{priceId}")
022 *             .build()
023 * </code></pre>
024 * </div>
025 */
026@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
027public class ChangePriceChangeBuilder implements Builder<ChangePriceChange> {
028
029    private String change;
030
031    private com.commercetools.history.models.common.Price previousValue;
032
033    private com.commercetools.history.models.common.Price nextValue;
034
035    private String catalogData;
036
037    private String priceId;
038
039    /**
040     * set the value to the change
041     * @param change value to be set
042     * @return Builder
043     */
044
045    public ChangePriceChangeBuilder change(final String change) {
046        this.change = change;
047        return this;
048    }
049
050    /**
051     *  <p>Value before the change.</p>
052     * @param builder function to build the previousValue value
053     * @return Builder
054     */
055
056    public ChangePriceChangeBuilder previousValue(
057            Function<com.commercetools.history.models.common.PriceBuilder, com.commercetools.history.models.common.PriceBuilder> builder) {
058        this.previousValue = builder.apply(com.commercetools.history.models.common.PriceBuilder.of()).build();
059        return this;
060    }
061
062    /**
063     *  <p>Value before the change.</p>
064     * @param builder function to build the previousValue value
065     * @return Builder
066     */
067
068    public ChangePriceChangeBuilder withPreviousValue(
069            Function<com.commercetools.history.models.common.PriceBuilder, com.commercetools.history.models.common.Price> builder) {
070        this.previousValue = builder.apply(com.commercetools.history.models.common.PriceBuilder.of());
071        return this;
072    }
073
074    /**
075     *  <p>Value before the change.</p>
076     * @param previousValue value to be set
077     * @return Builder
078     */
079
080    public ChangePriceChangeBuilder previousValue(final com.commercetools.history.models.common.Price previousValue) {
081        this.previousValue = previousValue;
082        return this;
083    }
084
085    /**
086     *  <p>Value after the change.</p>
087     * @param builder function to build the nextValue value
088     * @return Builder
089     */
090
091    public ChangePriceChangeBuilder nextValue(
092            Function<com.commercetools.history.models.common.PriceBuilder, com.commercetools.history.models.common.PriceBuilder> builder) {
093        this.nextValue = builder.apply(com.commercetools.history.models.common.PriceBuilder.of()).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 ChangePriceChangeBuilder withNextValue(
104            Function<com.commercetools.history.models.common.PriceBuilder, com.commercetools.history.models.common.Price> builder) {
105        this.nextValue = builder.apply(com.commercetools.history.models.common.PriceBuilder.of());
106        return this;
107    }
108
109    /**
110     *  <p>Value after the change.</p>
111     * @param nextValue value to be set
112     * @return Builder
113     */
114
115    public ChangePriceChangeBuilder nextValue(final com.commercetools.history.models.common.Price nextValue) {
116        this.nextValue = nextValue;
117        return this;
118    }
119
120    /**
121     *  <ul>
122     *   <li><code>staged</code>, if the staged ProductCatalogData was updated.</li>
123     *   <li><code>current</code>, if the current ProductCatalogData was updated.</li>
124     *  </ul>
125     * @param catalogData value to be set
126     * @return Builder
127     */
128
129    public ChangePriceChangeBuilder catalogData(final String catalogData) {
130        this.catalogData = catalogData;
131        return this;
132    }
133
134    /**
135     *  <p><code>id</code> of the Embedded Price.</p>
136     * @param priceId value to be set
137     * @return Builder
138     */
139
140    public ChangePriceChangeBuilder priceId(final String priceId) {
141        this.priceId = priceId;
142        return this;
143    }
144
145    /**
146     * value of change}
147     * @return change
148     */
149
150    public String getChange() {
151        return this.change;
152    }
153
154    /**
155     *  <p>Value before the change.</p>
156     * @return previousValue
157     */
158
159    public com.commercetools.history.models.common.Price getPreviousValue() {
160        return this.previousValue;
161    }
162
163    /**
164     *  <p>Value after the change.</p>
165     * @return nextValue
166     */
167
168    public com.commercetools.history.models.common.Price getNextValue() {
169        return this.nextValue;
170    }
171
172    /**
173     *  <ul>
174     *   <li><code>staged</code>, if the staged ProductCatalogData was updated.</li>
175     *   <li><code>current</code>, if the current ProductCatalogData was updated.</li>
176     *  </ul>
177     * @return catalogData
178     */
179
180    public String getCatalogData() {
181        return this.catalogData;
182    }
183
184    /**
185     *  <p><code>id</code> of the Embedded Price.</p>
186     * @return priceId
187     */
188
189    public String getPriceId() {
190        return this.priceId;
191    }
192
193    /**
194     * builds ChangePriceChange with checking for non-null required values
195     * @return ChangePriceChange
196     */
197    public ChangePriceChange build() {
198        Objects.requireNonNull(change, ChangePriceChange.class + ": change is missing");
199        Objects.requireNonNull(previousValue, ChangePriceChange.class + ": previousValue is missing");
200        Objects.requireNonNull(nextValue, ChangePriceChange.class + ": nextValue is missing");
201        Objects.requireNonNull(catalogData, ChangePriceChange.class + ": catalogData is missing");
202        Objects.requireNonNull(priceId, ChangePriceChange.class + ": priceId is missing");
203        return new ChangePriceChangeImpl(change, previousValue, nextValue, catalogData, priceId);
204    }
205
206    /**
207     * builds ChangePriceChange without checking for non-null required values
208     * @return ChangePriceChange
209     */
210    public ChangePriceChange buildUnchecked() {
211        return new ChangePriceChangeImpl(change, previousValue, nextValue, catalogData, priceId);
212    }
213
214    /**
215     * factory method for an instance of ChangePriceChangeBuilder
216     * @return builder
217     */
218    public static ChangePriceChangeBuilder of() {
219        return new ChangePriceChangeBuilder();
220    }
221
222    /**
223     * create builder for ChangePriceChange instance
224     * @param template instance with prefilled values for the builder
225     * @return builder
226     */
227    public static ChangePriceChangeBuilder of(final ChangePriceChange template) {
228        ChangePriceChangeBuilder builder = new ChangePriceChangeBuilder();
229        builder.change = template.getChange();
230        builder.previousValue = template.getPreviousValue();
231        builder.nextValue = template.getNextValue();
232        builder.catalogData = template.getCatalogData();
233        builder.priceId = template.getPriceId();
234        return builder;
235    }
236
237}