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 * ChangeAssociateChangeBuilder
012 * <hr>
013 * Example to create an instance using the builder pattern
014 * <div class=code-example>
015 * <pre><code class='java'>
016 *     ChangeAssociateChange changeAssociateChange = ChangeAssociateChange.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 ChangeAssociateChangeBuilder implements Builder<ChangeAssociateChange> {
026
027    private String change;
028
029    private com.commercetools.history.models.common.Associate previousValue;
030
031    private com.commercetools.history.models.common.Associate nextValue;
032
033    /**
034     * set the value to the change
035     * @param change value to be set
036     * @return Builder
037     */
038
039    public ChangeAssociateChangeBuilder 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 ChangeAssociateChangeBuilder previousValue(
051            Function<com.commercetools.history.models.common.AssociateBuilder, com.commercetools.history.models.common.AssociateBuilder> builder) {
052        this.previousValue = builder.apply(com.commercetools.history.models.common.AssociateBuilder.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 ChangeAssociateChangeBuilder withPreviousValue(
063            Function<com.commercetools.history.models.common.AssociateBuilder, com.commercetools.history.models.common.Associate> builder) {
064        this.previousValue = builder.apply(com.commercetools.history.models.common.AssociateBuilder.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 ChangeAssociateChangeBuilder previousValue(
075            final com.commercetools.history.models.common.Associate 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 ChangeAssociateChangeBuilder nextValue(
087            Function<com.commercetools.history.models.common.AssociateBuilder, com.commercetools.history.models.common.AssociateBuilder> builder) {
088        this.nextValue = builder.apply(com.commercetools.history.models.common.AssociateBuilder.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 ChangeAssociateChangeBuilder withNextValue(
099            Function<com.commercetools.history.models.common.AssociateBuilder, com.commercetools.history.models.common.Associate> builder) {
100        this.nextValue = builder.apply(com.commercetools.history.models.common.AssociateBuilder.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 ChangeAssociateChangeBuilder nextValue(final com.commercetools.history.models.common.Associate nextValue) {
111        this.nextValue = nextValue;
112        return this;
113    }
114
115    /**
116     * value of change}
117     * @return change
118     */
119
120    public String getChange() {
121        return this.change;
122    }
123
124    /**
125     *  <p>Value before the change.</p>
126     * @return previousValue
127     */
128
129    public com.commercetools.history.models.common.Associate getPreviousValue() {
130        return this.previousValue;
131    }
132
133    /**
134     *  <p>Value after the change.</p>
135     * @return nextValue
136     */
137
138    public com.commercetools.history.models.common.Associate getNextValue() {
139        return this.nextValue;
140    }
141
142    /**
143     * builds ChangeAssociateChange with checking for non-null required values
144     * @return ChangeAssociateChange
145     */
146    public ChangeAssociateChange build() {
147        Objects.requireNonNull(change, ChangeAssociateChange.class + ": change is missing");
148        Objects.requireNonNull(previousValue, ChangeAssociateChange.class + ": previousValue is missing");
149        Objects.requireNonNull(nextValue, ChangeAssociateChange.class + ": nextValue is missing");
150        return new ChangeAssociateChangeImpl(change, previousValue, nextValue);
151    }
152
153    /**
154     * builds ChangeAssociateChange without checking for non-null required values
155     * @return ChangeAssociateChange
156     */
157    public ChangeAssociateChange buildUnchecked() {
158        return new ChangeAssociateChangeImpl(change, previousValue, nextValue);
159    }
160
161    /**
162     * factory method for an instance of ChangeAssociateChangeBuilder
163     * @return builder
164     */
165    public static ChangeAssociateChangeBuilder of() {
166        return new ChangeAssociateChangeBuilder();
167    }
168
169    /**
170     * create builder for ChangeAssociateChange instance
171     * @param template instance with prefilled values for the builder
172     * @return builder
173     */
174    public static ChangeAssociateChangeBuilder of(final ChangeAssociateChange template) {
175        ChangeAssociateChangeBuilder builder = new ChangeAssociateChangeBuilder();
176        builder.change = template.getChange();
177        builder.previousValue = template.getPreviousValue();
178        builder.nextValue = template.getNextValue();
179        return builder;
180    }
181
182}