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 * ChangeProductSelectionActiveChangeBuilder
012 * <hr>
013 * Example to create an instance using the builder pattern
014 * <div class=code-example>
015 * <pre><code class='java'>
016 *     ChangeProductSelectionActiveChange changeProductSelectionActiveChange = ChangeProductSelectionActiveChange.builder()
017 *             .change("{change}")
018 *             .productSelection(productSelectionBuilder -> productSelectionBuilder)
019 *             .previousValue(true)
020 *             .nextValue(true)
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 ChangeProductSelectionActiveChangeBuilder implements Builder<ChangeProductSelectionActiveChange> {
027
028    private String change;
029
030    private com.commercetools.history.models.common.Reference productSelection;
031
032    private Boolean previousValue;
033
034    private Boolean nextValue;
035
036    /**
037     * set the value to the change
038     * @param change value to be set
039     * @return Builder
040     */
041
042    public ChangeProductSelectionActiveChangeBuilder change(final String change) {
043        this.change = change;
044        return this;
045    }
046
047    /**
048     *  <p>Reference to the Product Selection which was changed.</p>
049     * @param builder function to build the productSelection value
050     * @return Builder
051     */
052
053    public ChangeProductSelectionActiveChangeBuilder productSelection(
054            Function<com.commercetools.history.models.common.ReferenceBuilder, com.commercetools.history.models.common.ReferenceBuilder> builder) {
055        this.productSelection = builder.apply(com.commercetools.history.models.common.ReferenceBuilder.of()).build();
056        return this;
057    }
058
059    /**
060     *  <p>Reference to the Product Selection which was changed.</p>
061     * @param builder function to build the productSelection value
062     * @return Builder
063     */
064
065    public ChangeProductSelectionActiveChangeBuilder withProductSelection(
066            Function<com.commercetools.history.models.common.ReferenceBuilder, com.commercetools.history.models.common.Reference> builder) {
067        this.productSelection = builder.apply(com.commercetools.history.models.common.ReferenceBuilder.of());
068        return this;
069    }
070
071    /**
072     *  <p>Reference to the Product Selection which was changed.</p>
073     * @param productSelection value to be set
074     * @return Builder
075     */
076
077    public ChangeProductSelectionActiveChangeBuilder productSelection(
078            final com.commercetools.history.models.common.Reference productSelection) {
079        this.productSelection = productSelection;
080        return this;
081    }
082
083    /**
084     *  <p>Value before the change.</p>
085     * @param previousValue value to be set
086     * @return Builder
087     */
088
089    public ChangeProductSelectionActiveChangeBuilder previousValue(final Boolean previousValue) {
090        this.previousValue = previousValue;
091        return this;
092    }
093
094    /**
095     *  <p>Value after the change.</p>
096     * @param nextValue value to be set
097     * @return Builder
098     */
099
100    public ChangeProductSelectionActiveChangeBuilder nextValue(final Boolean nextValue) {
101        this.nextValue = nextValue;
102        return this;
103    }
104
105    /**
106     * value of change}
107     * @return change
108     */
109
110    public String getChange() {
111        return this.change;
112    }
113
114    /**
115     *  <p>Reference to the Product Selection which was changed.</p>
116     * @return productSelection
117     */
118
119    public com.commercetools.history.models.common.Reference getProductSelection() {
120        return this.productSelection;
121    }
122
123    /**
124     *  <p>Value before the change.</p>
125     * @return previousValue
126     */
127
128    public Boolean getPreviousValue() {
129        return this.previousValue;
130    }
131
132    /**
133     *  <p>Value after the change.</p>
134     * @return nextValue
135     */
136
137    public Boolean getNextValue() {
138        return this.nextValue;
139    }
140
141    /**
142     * builds ChangeProductSelectionActiveChange with checking for non-null required values
143     * @return ChangeProductSelectionActiveChange
144     */
145    public ChangeProductSelectionActiveChange build() {
146        Objects.requireNonNull(change, ChangeProductSelectionActiveChange.class + ": change is missing");
147        Objects.requireNonNull(productSelection,
148            ChangeProductSelectionActiveChange.class + ": productSelection is missing");
149        Objects.requireNonNull(previousValue, ChangeProductSelectionActiveChange.class + ": previousValue is missing");
150        Objects.requireNonNull(nextValue, ChangeProductSelectionActiveChange.class + ": nextValue is missing");
151        return new ChangeProductSelectionActiveChangeImpl(change, productSelection, previousValue, nextValue);
152    }
153
154    /**
155     * builds ChangeProductSelectionActiveChange without checking for non-null required values
156     * @return ChangeProductSelectionActiveChange
157     */
158    public ChangeProductSelectionActiveChange buildUnchecked() {
159        return new ChangeProductSelectionActiveChangeImpl(change, productSelection, previousValue, nextValue);
160    }
161
162    /**
163     * factory method for an instance of ChangeProductSelectionActiveChangeBuilder
164     * @return builder
165     */
166    public static ChangeProductSelectionActiveChangeBuilder of() {
167        return new ChangeProductSelectionActiveChangeBuilder();
168    }
169
170    /**
171     * create builder for ChangeProductSelectionActiveChange instance
172     * @param template instance with prefilled values for the builder
173     * @return builder
174     */
175    public static ChangeProductSelectionActiveChangeBuilder of(final ChangeProductSelectionActiveChange template) {
176        ChangeProductSelectionActiveChangeBuilder builder = new ChangeProductSelectionActiveChangeBuilder();
177        builder.change = template.getChange();
178        builder.productSelection = template.getProductSelection();
179        builder.previousValue = template.getPreviousValue();
180        builder.nextValue = template.getNextValue();
181        return builder;
182    }
183
184}