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