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 * ChangeQuantityChangeBuilder
012 * <hr>
013 * Example to create an instance using the builder pattern
014 * <div class=code-example>
015 * <pre><code class='java'>
016 *     ChangeQuantityChange changeQuantityChange = ChangeQuantityChange.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 ChangeQuantityChangeBuilder implements Builder<ChangeQuantityChange> {
026
027    private String change;
028
029    private com.commercetools.history.models.change_value.InventoryQuantityValue previousValue;
030
031    private com.commercetools.history.models.change_value.InventoryQuantityValue nextValue;
032
033    /**
034     * set the value to the change
035     * @param change value to be set
036     * @return Builder
037     */
038
039    public ChangeQuantityChangeBuilder change(final String change) {
040        this.change = change;
041        return this;
042    }
043
044    /**
045     *  <p>Value before the change.</p>
046     * @param builder function to build the previousValue value
047     * @return Builder
048     */
049
050    public ChangeQuantityChangeBuilder previousValue(
051            Function<com.commercetools.history.models.change_value.InventoryQuantityValueBuilder, com.commercetools.history.models.change_value.InventoryQuantityValueBuilder> builder) {
052        this.previousValue = builder
053                .apply(com.commercetools.history.models.change_value.InventoryQuantityValueBuilder.of())
054                .build();
055        return this;
056    }
057
058    /**
059     *  <p>Value before the change.</p>
060     * @param builder function to build the previousValue value
061     * @return Builder
062     */
063
064    public ChangeQuantityChangeBuilder withPreviousValue(
065            Function<com.commercetools.history.models.change_value.InventoryQuantityValueBuilder, com.commercetools.history.models.change_value.InventoryQuantityValue> builder) {
066        this.previousValue = builder
067                .apply(com.commercetools.history.models.change_value.InventoryQuantityValueBuilder.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 ChangeQuantityChangeBuilder previousValue(
078            final com.commercetools.history.models.change_value.InventoryQuantityValue 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 ChangeQuantityChangeBuilder nextValue(
090            Function<com.commercetools.history.models.change_value.InventoryQuantityValueBuilder, com.commercetools.history.models.change_value.InventoryQuantityValueBuilder> builder) {
091        this.nextValue = builder.apply(com.commercetools.history.models.change_value.InventoryQuantityValueBuilder.of())
092                .build();
093        return this;
094    }
095
096    /**
097     *  <p>Value after the change.</p>
098     * @param builder function to build the nextValue value
099     * @return Builder
100     */
101
102    public ChangeQuantityChangeBuilder withNextValue(
103            Function<com.commercetools.history.models.change_value.InventoryQuantityValueBuilder, com.commercetools.history.models.change_value.InventoryQuantityValue> builder) {
104        this.nextValue = builder
105                .apply(com.commercetools.history.models.change_value.InventoryQuantityValueBuilder.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 ChangeQuantityChangeBuilder nextValue(
116            final com.commercetools.history.models.change_value.InventoryQuantityValue nextValue) {
117        this.nextValue = nextValue;
118        return this;
119    }
120
121    /**
122     * value of change}
123     * @return change
124     */
125
126    public String getChange() {
127        return this.change;
128    }
129
130    /**
131     *  <p>Value before the change.</p>
132     * @return previousValue
133     */
134
135    public com.commercetools.history.models.change_value.InventoryQuantityValue getPreviousValue() {
136        return this.previousValue;
137    }
138
139    /**
140     *  <p>Value after the change.</p>
141     * @return nextValue
142     */
143
144    public com.commercetools.history.models.change_value.InventoryQuantityValue getNextValue() {
145        return this.nextValue;
146    }
147
148    /**
149     * builds ChangeQuantityChange with checking for non-null required values
150     * @return ChangeQuantityChange
151     */
152    public ChangeQuantityChange build() {
153        Objects.requireNonNull(change, ChangeQuantityChange.class + ": change is missing");
154        Objects.requireNonNull(previousValue, ChangeQuantityChange.class + ": previousValue is missing");
155        Objects.requireNonNull(nextValue, ChangeQuantityChange.class + ": nextValue is missing");
156        return new ChangeQuantityChangeImpl(change, previousValue, nextValue);
157    }
158
159    /**
160     * builds ChangeQuantityChange without checking for non-null required values
161     * @return ChangeQuantityChange
162     */
163    public ChangeQuantityChange buildUnchecked() {
164        return new ChangeQuantityChangeImpl(change, previousValue, nextValue);
165    }
166
167    /**
168     * factory method for an instance of ChangeQuantityChangeBuilder
169     * @return builder
170     */
171    public static ChangeQuantityChangeBuilder of() {
172        return new ChangeQuantityChangeBuilder();
173    }
174
175    /**
176     * create builder for ChangeQuantityChange instance
177     * @param template instance with prefilled values for the builder
178     * @return builder
179     */
180    public static ChangeQuantityChangeBuilder of(final ChangeQuantityChange template) {
181        ChangeQuantityChangeBuilder builder = new ChangeQuantityChangeBuilder();
182        builder.change = template.getChange();
183        builder.previousValue = template.getPreviousValue();
184        builder.nextValue = template.getNextValue();
185        return builder;
186    }
187
188}