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