001
002package com.commercetools.api.models.message;
003
004import java.util.*;
005import java.util.function.Function;
006
007import javax.annotation.Nullable;
008
009import io.vrap.rmf.base.client.Builder;
010import io.vrap.rmf.base.client.utils.Generated;
011
012/**
013 * CustomerAddressChangedMessageBuilder
014 * <hr>
015 * Example to create an instance using the builder pattern
016 * <div class=code-example>
017 * <pre><code class='java'>
018 *     CustomerAddressChangedMessage customerAddressChangedMessage = CustomerAddressChangedMessage.builder()
019 *             .id("{id}")
020 *             .version(0.3)
021 *             .createdAt(ZonedDateTime.parse("2022-01-01T12:00:00.301Z"))
022 *             .lastModifiedAt(ZonedDateTime.parse("2022-01-01T12:00:00.301Z"))
023 *             .sequenceNumber(0.3)
024 *             .resource(resourceBuilder -> resourceBuilder)
025 *             .resourceVersion(0.3)
026 *             .address(addressBuilder -> addressBuilder)
027 *             .build()
028 * </code></pre>
029 * </div>
030 */
031@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
032public class CustomerAddressChangedMessageBuilder implements Builder<CustomerAddressChangedMessage> {
033
034    private String id;
035
036    private Long version;
037
038    private java.time.ZonedDateTime createdAt;
039
040    private java.time.ZonedDateTime lastModifiedAt;
041
042    @Nullable
043    private com.commercetools.api.models.common.LastModifiedBy lastModifiedBy;
044
045    @Nullable
046    private com.commercetools.api.models.common.CreatedBy createdBy;
047
048    private Long sequenceNumber;
049
050    private com.commercetools.api.models.common.Reference resource;
051
052    private Long resourceVersion;
053
054    @Nullable
055    private com.commercetools.api.models.message.UserProvidedIdentifiers resourceUserProvidedIdentifiers;
056
057    private com.commercetools.api.models.common.Address address;
058
059    /**
060     *  <p>Unique identifier of the Message. Can be used to track which Messages have been processed.</p>
061     * @param id value to be set
062     * @return Builder
063     */
064
065    public CustomerAddressChangedMessageBuilder id(final String id) {
066        this.id = id;
067        return this;
068    }
069
070    /**
071     *  <p>Version of a resource. In case of Messages, this is always <code>1</code>.</p>
072     * @param version value to be set
073     * @return Builder
074     */
075
076    public CustomerAddressChangedMessageBuilder version(final Long version) {
077        this.version = version;
078        return this;
079    }
080
081    /**
082     *  <p>Date and time (UTC) the Message was generated.</p>
083     * @param createdAt value to be set
084     * @return Builder
085     */
086
087    public CustomerAddressChangedMessageBuilder createdAt(final java.time.ZonedDateTime createdAt) {
088        this.createdAt = createdAt;
089        return this;
090    }
091
092    /**
093     *  <p>Value of <code>createdAt</code>.</p>
094     * @param lastModifiedAt value to be set
095     * @return Builder
096     */
097
098    public CustomerAddressChangedMessageBuilder lastModifiedAt(final java.time.ZonedDateTime lastModifiedAt) {
099        this.lastModifiedAt = lastModifiedAt;
100        return this;
101    }
102
103    /**
104     *  <p>Value of <code>createdBy</code>.</p>
105     * @param builder function to build the lastModifiedBy value
106     * @return Builder
107     */
108
109    public CustomerAddressChangedMessageBuilder lastModifiedBy(
110            Function<com.commercetools.api.models.common.LastModifiedByBuilder, com.commercetools.api.models.common.LastModifiedByBuilder> builder) {
111        this.lastModifiedBy = builder.apply(com.commercetools.api.models.common.LastModifiedByBuilder.of()).build();
112        return this;
113    }
114
115    /**
116     *  <p>Value of <code>createdBy</code>.</p>
117     * @param builder function to build the lastModifiedBy value
118     * @return Builder
119     */
120
121    public CustomerAddressChangedMessageBuilder withLastModifiedBy(
122            Function<com.commercetools.api.models.common.LastModifiedByBuilder, com.commercetools.api.models.common.LastModifiedBy> builder) {
123        this.lastModifiedBy = builder.apply(com.commercetools.api.models.common.LastModifiedByBuilder.of());
124        return this;
125    }
126
127    /**
128     *  <p>Value of <code>createdBy</code>.</p>
129     * @param lastModifiedBy value to be set
130     * @return Builder
131     */
132
133    public CustomerAddressChangedMessageBuilder lastModifiedBy(
134            @Nullable final com.commercetools.api.models.common.LastModifiedBy lastModifiedBy) {
135        this.lastModifiedBy = lastModifiedBy;
136        return this;
137    }
138
139    /**
140     *  <p>Present on resources created after 1 February 2019 except for events not tracked.</p>
141     * @param builder function to build the createdBy value
142     * @return Builder
143     */
144
145    public CustomerAddressChangedMessageBuilder createdBy(
146            Function<com.commercetools.api.models.common.CreatedByBuilder, com.commercetools.api.models.common.CreatedByBuilder> builder) {
147        this.createdBy = builder.apply(com.commercetools.api.models.common.CreatedByBuilder.of()).build();
148        return this;
149    }
150
151    /**
152     *  <p>Present on resources created after 1 February 2019 except for events not tracked.</p>
153     * @param builder function to build the createdBy value
154     * @return Builder
155     */
156
157    public CustomerAddressChangedMessageBuilder withCreatedBy(
158            Function<com.commercetools.api.models.common.CreatedByBuilder, com.commercetools.api.models.common.CreatedBy> builder) {
159        this.createdBy = builder.apply(com.commercetools.api.models.common.CreatedByBuilder.of());
160        return this;
161    }
162
163    /**
164     *  <p>Present on resources created after 1 February 2019 except for events not tracked.</p>
165     * @param createdBy value to be set
166     * @return Builder
167     */
168
169    public CustomerAddressChangedMessageBuilder createdBy(
170            @Nullable final com.commercetools.api.models.common.CreatedBy createdBy) {
171        this.createdBy = createdBy;
172        return this;
173    }
174
175    /**
176     *  <p>Message number in relation to other Messages for a given resource. The <code>sequenceNumber</code> of the next Message for the resource is the successor of the <code>sequenceNumber</code> of the current Message. Meaning, the <code>sequenceNumber</code> of the next Message equals the <code>sequenceNumber</code> of the current Message + 1. <code>sequenceNumber</code> can be used to ensure that Messages are processed in the correct order for a particular resource.</p>
177     * @param sequenceNumber value to be set
178     * @return Builder
179     */
180
181    public CustomerAddressChangedMessageBuilder sequenceNumber(final Long sequenceNumber) {
182        this.sequenceNumber = sequenceNumber;
183        return this;
184    }
185
186    /**
187     *  <p>Reference to the resource on which the change or action was performed.</p>
188     * @param resource value to be set
189     * @return Builder
190     */
191
192    public CustomerAddressChangedMessageBuilder resource(final com.commercetools.api.models.common.Reference resource) {
193        this.resource = resource;
194        return this;
195    }
196
197    /**
198     *  <p>Reference to the resource on which the change or action was performed.</p>
199     * @param builder function to build the resource value
200     * @return Builder
201     */
202
203    public CustomerAddressChangedMessageBuilder resource(
204            Function<com.commercetools.api.models.common.ReferenceBuilder, Builder<? extends com.commercetools.api.models.common.Reference>> builder) {
205        this.resource = builder.apply(com.commercetools.api.models.common.ReferenceBuilder.of()).build();
206        return this;
207    }
208
209    /**
210     *  <p>Version of the resource on which the change or action was performed.</p>
211     * @param resourceVersion value to be set
212     * @return Builder
213     */
214
215    public CustomerAddressChangedMessageBuilder resourceVersion(final Long resourceVersion) {
216        this.resourceVersion = resourceVersion;
217        return this;
218    }
219
220    /**
221     *  <p>User-provided identifiers of the resource, such as <code>key</code> or <code>externalId</code>. Only present if the resource has such identifiers.</p>
222     * @param builder function to build the resourceUserProvidedIdentifiers value
223     * @return Builder
224     */
225
226    public CustomerAddressChangedMessageBuilder resourceUserProvidedIdentifiers(
227            Function<com.commercetools.api.models.message.UserProvidedIdentifiersBuilder, com.commercetools.api.models.message.UserProvidedIdentifiersBuilder> builder) {
228        this.resourceUserProvidedIdentifiers = builder
229                .apply(com.commercetools.api.models.message.UserProvidedIdentifiersBuilder.of())
230                .build();
231        return this;
232    }
233
234    /**
235     *  <p>User-provided identifiers of the resource, such as <code>key</code> or <code>externalId</code>. Only present if the resource has such identifiers.</p>
236     * @param builder function to build the resourceUserProvidedIdentifiers value
237     * @return Builder
238     */
239
240    public CustomerAddressChangedMessageBuilder withResourceUserProvidedIdentifiers(
241            Function<com.commercetools.api.models.message.UserProvidedIdentifiersBuilder, com.commercetools.api.models.message.UserProvidedIdentifiers> builder) {
242        this.resourceUserProvidedIdentifiers = builder
243                .apply(com.commercetools.api.models.message.UserProvidedIdentifiersBuilder.of());
244        return this;
245    }
246
247    /**
248     *  <p>User-provided identifiers of the resource, such as <code>key</code> or <code>externalId</code>. Only present if the resource has such identifiers.</p>
249     * @param resourceUserProvidedIdentifiers value to be set
250     * @return Builder
251     */
252
253    public CustomerAddressChangedMessageBuilder resourceUserProvidedIdentifiers(
254            @Nullable final com.commercetools.api.models.message.UserProvidedIdentifiers resourceUserProvidedIdentifiers) {
255        this.resourceUserProvidedIdentifiers = resourceUserProvidedIdentifiers;
256        return this;
257    }
258
259    /**
260     *  <p>Address that was set during the Change Address update action.</p>
261     * @param builder function to build the address value
262     * @return Builder
263     */
264
265    public CustomerAddressChangedMessageBuilder address(
266            Function<com.commercetools.api.models.common.AddressBuilder, com.commercetools.api.models.common.AddressBuilder> builder) {
267        this.address = builder.apply(com.commercetools.api.models.common.AddressBuilder.of()).build();
268        return this;
269    }
270
271    /**
272     *  <p>Address that was set during the Change Address update action.</p>
273     * @param builder function to build the address value
274     * @return Builder
275     */
276
277    public CustomerAddressChangedMessageBuilder withAddress(
278            Function<com.commercetools.api.models.common.AddressBuilder, com.commercetools.api.models.common.Address> builder) {
279        this.address = builder.apply(com.commercetools.api.models.common.AddressBuilder.of());
280        return this;
281    }
282
283    /**
284     *  <p>Address that was set during the Change Address update action.</p>
285     * @param address value to be set
286     * @return Builder
287     */
288
289    public CustomerAddressChangedMessageBuilder address(final com.commercetools.api.models.common.Address address) {
290        this.address = address;
291        return this;
292    }
293
294    /**
295     *  <p>Unique identifier of the Message. Can be used to track which Messages have been processed.</p>
296     * @return id
297     */
298
299    public String getId() {
300        return this.id;
301    }
302
303    /**
304     *  <p>Version of a resource. In case of Messages, this is always <code>1</code>.</p>
305     * @return version
306     */
307
308    public Long getVersion() {
309        return this.version;
310    }
311
312    /**
313     *  <p>Date and time (UTC) the Message was generated.</p>
314     * @return createdAt
315     */
316
317    public java.time.ZonedDateTime getCreatedAt() {
318        return this.createdAt;
319    }
320
321    /**
322     *  <p>Value of <code>createdAt</code>.</p>
323     * @return lastModifiedAt
324     */
325
326    public java.time.ZonedDateTime getLastModifiedAt() {
327        return this.lastModifiedAt;
328    }
329
330    /**
331     *  <p>Value of <code>createdBy</code>.</p>
332     * @return lastModifiedBy
333     */
334
335    @Nullable
336    public com.commercetools.api.models.common.LastModifiedBy getLastModifiedBy() {
337        return this.lastModifiedBy;
338    }
339
340    /**
341     *  <p>Present on resources created after 1 February 2019 except for events not tracked.</p>
342     * @return createdBy
343     */
344
345    @Nullable
346    public com.commercetools.api.models.common.CreatedBy getCreatedBy() {
347        return this.createdBy;
348    }
349
350    /**
351     *  <p>Message number in relation to other Messages for a given resource. The <code>sequenceNumber</code> of the next Message for the resource is the successor of the <code>sequenceNumber</code> of the current Message. Meaning, the <code>sequenceNumber</code> of the next Message equals the <code>sequenceNumber</code> of the current Message + 1. <code>sequenceNumber</code> can be used to ensure that Messages are processed in the correct order for a particular resource.</p>
352     * @return sequenceNumber
353     */
354
355    public Long getSequenceNumber() {
356        return this.sequenceNumber;
357    }
358
359    /**
360     *  <p>Reference to the resource on which the change or action was performed.</p>
361     * @return resource
362     */
363
364    public com.commercetools.api.models.common.Reference getResource() {
365        return this.resource;
366    }
367
368    /**
369     *  <p>Version of the resource on which the change or action was performed.</p>
370     * @return resourceVersion
371     */
372
373    public Long getResourceVersion() {
374        return this.resourceVersion;
375    }
376
377    /**
378     *  <p>User-provided identifiers of the resource, such as <code>key</code> or <code>externalId</code>. Only present if the resource has such identifiers.</p>
379     * @return resourceUserProvidedIdentifiers
380     */
381
382    @Nullable
383    public com.commercetools.api.models.message.UserProvidedIdentifiers getResourceUserProvidedIdentifiers() {
384        return this.resourceUserProvidedIdentifiers;
385    }
386
387    /**
388     *  <p>Address that was set during the Change Address update action.</p>
389     * @return address
390     */
391
392    public com.commercetools.api.models.common.Address getAddress() {
393        return this.address;
394    }
395
396    /**
397     * builds CustomerAddressChangedMessage with checking for non-null required values
398     * @return CustomerAddressChangedMessage
399     */
400    public CustomerAddressChangedMessage build() {
401        Objects.requireNonNull(id, CustomerAddressChangedMessage.class + ": id is missing");
402        Objects.requireNonNull(version, CustomerAddressChangedMessage.class + ": version is missing");
403        Objects.requireNonNull(createdAt, CustomerAddressChangedMessage.class + ": createdAt is missing");
404        Objects.requireNonNull(lastModifiedAt, CustomerAddressChangedMessage.class + ": lastModifiedAt is missing");
405        Objects.requireNonNull(sequenceNumber, CustomerAddressChangedMessage.class + ": sequenceNumber is missing");
406        Objects.requireNonNull(resource, CustomerAddressChangedMessage.class + ": resource is missing");
407        Objects.requireNonNull(resourceVersion, CustomerAddressChangedMessage.class + ": resourceVersion is missing");
408        Objects.requireNonNull(address, CustomerAddressChangedMessage.class + ": address is missing");
409        return new CustomerAddressChangedMessageImpl(id, version, createdAt, lastModifiedAt, lastModifiedBy, createdBy,
410            sequenceNumber, resource, resourceVersion, resourceUserProvidedIdentifiers, address);
411    }
412
413    /**
414     * builds CustomerAddressChangedMessage without checking for non-null required values
415     * @return CustomerAddressChangedMessage
416     */
417    public CustomerAddressChangedMessage buildUnchecked() {
418        return new CustomerAddressChangedMessageImpl(id, version, createdAt, lastModifiedAt, lastModifiedBy, createdBy,
419            sequenceNumber, resource, resourceVersion, resourceUserProvidedIdentifiers, address);
420    }
421
422    /**
423     * factory method for an instance of CustomerAddressChangedMessageBuilder
424     * @return builder
425     */
426    public static CustomerAddressChangedMessageBuilder of() {
427        return new CustomerAddressChangedMessageBuilder();
428    }
429
430    /**
431     * create builder for CustomerAddressChangedMessage instance
432     * @param template instance with prefilled values for the builder
433     * @return builder
434     */
435    public static CustomerAddressChangedMessageBuilder of(final CustomerAddressChangedMessage template) {
436        CustomerAddressChangedMessageBuilder builder = new CustomerAddressChangedMessageBuilder();
437        builder.id = template.getId();
438        builder.version = template.getVersion();
439        builder.createdAt = template.getCreatedAt();
440        builder.lastModifiedAt = template.getLastModifiedAt();
441        builder.lastModifiedBy = template.getLastModifiedBy();
442        builder.createdBy = template.getCreatedBy();
443        builder.sequenceNumber = template.getSequenceNumber();
444        builder.resource = template.getResource();
445        builder.resourceVersion = template.getResourceVersion();
446        builder.resourceUserProvidedIdentifiers = template.getResourceUserProvidedIdentifiers();
447        builder.address = template.getAddress();
448        return builder;
449    }
450
451}