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 * OrderBillingAddressSetMessagePayloadBuilder
014 * <hr>
015 * Example to create an instance using the builder pattern
016 * <div class=code-example>
017 * <pre><code class='java'>
018 *     OrderBillingAddressSetMessagePayload orderBillingAddressSetMessagePayload = OrderBillingAddressSetMessagePayload.builder()
019 *             .build()
020 * </code></pre>
021 * </div>
022 */
023@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
024public class OrderBillingAddressSetMessagePayloadBuilder implements Builder<OrderBillingAddressSetMessagePayload> {
025
026    @Nullable
027    private com.commercetools.api.models.common.Address address;
028
029    @Nullable
030    private com.commercetools.api.models.common.Address oldAddress;
031
032    /**
033     *  <p>Billing address on the Order after the Set Billing Address update action.</p>
034     * @param builder function to build the address value
035     * @return Builder
036     */
037
038    public OrderBillingAddressSetMessagePayloadBuilder address(
039            Function<com.commercetools.api.models.common.AddressBuilder, com.commercetools.api.models.common.AddressBuilder> builder) {
040        this.address = builder.apply(com.commercetools.api.models.common.AddressBuilder.of()).build();
041        return this;
042    }
043
044    /**
045     *  <p>Billing address on the Order after the Set Billing Address update action.</p>
046     * @param builder function to build the address value
047     * @return Builder
048     */
049
050    public OrderBillingAddressSetMessagePayloadBuilder withAddress(
051            Function<com.commercetools.api.models.common.AddressBuilder, com.commercetools.api.models.common.Address> builder) {
052        this.address = builder.apply(com.commercetools.api.models.common.AddressBuilder.of());
053        return this;
054    }
055
056    /**
057     *  <p>Billing address on the Order after the Set Billing Address update action.</p>
058     * @param address value to be set
059     * @return Builder
060     */
061
062    public OrderBillingAddressSetMessagePayloadBuilder address(
063            @Nullable final com.commercetools.api.models.common.Address address) {
064        this.address = address;
065        return this;
066    }
067
068    /**
069     *  <p>Billing address on the Order before the Set Billing Address update action.</p>
070     * @param builder function to build the oldAddress value
071     * @return Builder
072     */
073
074    public OrderBillingAddressSetMessagePayloadBuilder oldAddress(
075            Function<com.commercetools.api.models.common.AddressBuilder, com.commercetools.api.models.common.AddressBuilder> builder) {
076        this.oldAddress = builder.apply(com.commercetools.api.models.common.AddressBuilder.of()).build();
077        return this;
078    }
079
080    /**
081     *  <p>Billing address on the Order before the Set Billing Address update action.</p>
082     * @param builder function to build the oldAddress value
083     * @return Builder
084     */
085
086    public OrderBillingAddressSetMessagePayloadBuilder withOldAddress(
087            Function<com.commercetools.api.models.common.AddressBuilder, com.commercetools.api.models.common.Address> builder) {
088        this.oldAddress = builder.apply(com.commercetools.api.models.common.AddressBuilder.of());
089        return this;
090    }
091
092    /**
093     *  <p>Billing address on the Order before the Set Billing Address update action.</p>
094     * @param oldAddress value to be set
095     * @return Builder
096     */
097
098    public OrderBillingAddressSetMessagePayloadBuilder oldAddress(
099            @Nullable final com.commercetools.api.models.common.Address oldAddress) {
100        this.oldAddress = oldAddress;
101        return this;
102    }
103
104    /**
105     *  <p>Billing address on the Order after the Set Billing Address update action.</p>
106     * @return address
107     */
108
109    @Nullable
110    public com.commercetools.api.models.common.Address getAddress() {
111        return this.address;
112    }
113
114    /**
115     *  <p>Billing address on the Order before the Set Billing Address update action.</p>
116     * @return oldAddress
117     */
118
119    @Nullable
120    public com.commercetools.api.models.common.Address getOldAddress() {
121        return this.oldAddress;
122    }
123
124    /**
125     * builds OrderBillingAddressSetMessagePayload with checking for non-null required values
126     * @return OrderBillingAddressSetMessagePayload
127     */
128    public OrderBillingAddressSetMessagePayload build() {
129        return new OrderBillingAddressSetMessagePayloadImpl(address, oldAddress);
130    }
131
132    /**
133     * builds OrderBillingAddressSetMessagePayload without checking for non-null required values
134     * @return OrderBillingAddressSetMessagePayload
135     */
136    public OrderBillingAddressSetMessagePayload buildUnchecked() {
137        return new OrderBillingAddressSetMessagePayloadImpl(address, oldAddress);
138    }
139
140    /**
141     * factory method for an instance of OrderBillingAddressSetMessagePayloadBuilder
142     * @return builder
143     */
144    public static OrderBillingAddressSetMessagePayloadBuilder of() {
145        return new OrderBillingAddressSetMessagePayloadBuilder();
146    }
147
148    /**
149     * create builder for OrderBillingAddressSetMessagePayload instance
150     * @param template instance with prefilled values for the builder
151     * @return builder
152     */
153    public static OrderBillingAddressSetMessagePayloadBuilder of(final OrderBillingAddressSetMessagePayload template) {
154        OrderBillingAddressSetMessagePayloadBuilder builder = new OrderBillingAddressSetMessagePayloadBuilder();
155        builder.address = template.getAddress();
156        builder.oldAddress = template.getOldAddress();
157        return builder;
158    }
159
160}