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 * SetAddressCustomFieldChangeBuilder
012 * <hr>
013 * Example to create an instance using the builder pattern
014 * <div class=code-example>
015 * <pre><code class='java'>
016 *     SetAddressCustomFieldChange setAddressCustomFieldChange = SetAddressCustomFieldChange.builder()
017 *             .change("{change}")
018 *             .address(addressBuilder -> addressBuilder)
019 *             .name("{name}")
020 *             .customTypeId("{customTypeId}")
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 SetAddressCustomFieldChangeBuilder implements Builder<SetAddressCustomFieldChange> {
027
028    private String change;
029
030    private com.commercetools.history.models.common.Address address;
031
032    private String name;
033
034    private String customTypeId;
035
036    private java.lang.Object previousValue;
037
038    private java.lang.Object nextValue;
039
040    /**
041     * set the value to the change
042     * @param change value to be set
043     * @return Builder
044     */
045
046    public SetAddressCustomFieldChangeBuilder change(final String change) {
047        this.change = change;
048        return this;
049    }
050
051    /**
052     *  <p>Address which was extended.</p>
053     * @param builder function to build the address value
054     * @return Builder
055     */
056
057    public SetAddressCustomFieldChangeBuilder address(
058            Function<com.commercetools.history.models.common.AddressBuilder, com.commercetools.history.models.common.AddressBuilder> builder) {
059        this.address = builder.apply(com.commercetools.history.models.common.AddressBuilder.of()).build();
060        return this;
061    }
062
063    /**
064     *  <p>Address which was extended.</p>
065     * @param builder function to build the address value
066     * @return Builder
067     */
068
069    public SetAddressCustomFieldChangeBuilder withAddress(
070            Function<com.commercetools.history.models.common.AddressBuilder, com.commercetools.history.models.common.Address> builder) {
071        this.address = builder.apply(com.commercetools.history.models.common.AddressBuilder.of());
072        return this;
073    }
074
075    /**
076     *  <p>Address which was extended.</p>
077     * @param address value to be set
078     * @return Builder
079     */
080
081    public SetAddressCustomFieldChangeBuilder address(final com.commercetools.history.models.common.Address address) {
082        this.address = address;
083        return this;
084    }
085
086    /**
087     *  <p>Name of the Custom Field.</p>
088     * @param name value to be set
089     * @return Builder
090     */
091
092    public SetAddressCustomFieldChangeBuilder name(final String name) {
093        this.name = name;
094        return this;
095    }
096
097    /**
098     *  <p><code>id</code> of the referenced Type.</p>
099     * @param customTypeId value to be set
100     * @return Builder
101     */
102
103    public SetAddressCustomFieldChangeBuilder customTypeId(final String customTypeId) {
104        this.customTypeId = customTypeId;
105        return this;
106    }
107
108    /**
109     *  <p>Value before the change.</p>
110     * @param previousValue value to be set
111     * @return Builder
112     */
113
114    public SetAddressCustomFieldChangeBuilder previousValue(final java.lang.Object previousValue) {
115        this.previousValue = previousValue;
116        return this;
117    }
118
119    /**
120     *  <p>Value after the change.</p>
121     * @param nextValue value to be set
122     * @return Builder
123     */
124
125    public SetAddressCustomFieldChangeBuilder nextValue(final java.lang.Object nextValue) {
126        this.nextValue = nextValue;
127        return this;
128    }
129
130    /**
131     * value of change}
132     * @return change
133     */
134
135    public String getChange() {
136        return this.change;
137    }
138
139    /**
140     *  <p>Address which was extended.</p>
141     * @return address
142     */
143
144    public com.commercetools.history.models.common.Address getAddress() {
145        return this.address;
146    }
147
148    /**
149     *  <p>Name of the Custom Field.</p>
150     * @return name
151     */
152
153    public String getName() {
154        return this.name;
155    }
156
157    /**
158     *  <p><code>id</code> of the referenced Type.</p>
159     * @return customTypeId
160     */
161
162    public String getCustomTypeId() {
163        return this.customTypeId;
164    }
165
166    /**
167     *  <p>Value before the change.</p>
168     * @return previousValue
169     */
170
171    public java.lang.Object getPreviousValue() {
172        return this.previousValue;
173    }
174
175    /**
176     *  <p>Value after the change.</p>
177     * @return nextValue
178     */
179
180    public java.lang.Object getNextValue() {
181        return this.nextValue;
182    }
183
184    /**
185     * builds SetAddressCustomFieldChange with checking for non-null required values
186     * @return SetAddressCustomFieldChange
187     */
188    public SetAddressCustomFieldChange build() {
189        Objects.requireNonNull(change, SetAddressCustomFieldChange.class + ": change is missing");
190        Objects.requireNonNull(address, SetAddressCustomFieldChange.class + ": address is missing");
191        Objects.requireNonNull(name, SetAddressCustomFieldChange.class + ": name is missing");
192        Objects.requireNonNull(customTypeId, SetAddressCustomFieldChange.class + ": customTypeId is missing");
193        Objects.requireNonNull(previousValue, SetAddressCustomFieldChange.class + ": previousValue is missing");
194        Objects.requireNonNull(nextValue, SetAddressCustomFieldChange.class + ": nextValue is missing");
195        return new SetAddressCustomFieldChangeImpl(change, address, name, customTypeId, previousValue, nextValue);
196    }
197
198    /**
199     * builds SetAddressCustomFieldChange without checking for non-null required values
200     * @return SetAddressCustomFieldChange
201     */
202    public SetAddressCustomFieldChange buildUnchecked() {
203        return new SetAddressCustomFieldChangeImpl(change, address, name, customTypeId, previousValue, nextValue);
204    }
205
206    /**
207     * factory method for an instance of SetAddressCustomFieldChangeBuilder
208     * @return builder
209     */
210    public static SetAddressCustomFieldChangeBuilder of() {
211        return new SetAddressCustomFieldChangeBuilder();
212    }
213
214    /**
215     * create builder for SetAddressCustomFieldChange instance
216     * @param template instance with prefilled values for the builder
217     * @return builder
218     */
219    public static SetAddressCustomFieldChangeBuilder of(final SetAddressCustomFieldChange template) {
220        SetAddressCustomFieldChangeBuilder builder = new SetAddressCustomFieldChangeBuilder();
221        builder.change = template.getChange();
222        builder.address = template.getAddress();
223        builder.name = template.getName();
224        builder.customTypeId = template.getCustomTypeId();
225        builder.previousValue = template.getPreviousValue();
226        builder.nextValue = template.getNextValue();
227        return builder;
228    }
229
230}