001
002package com.commercetools.api.models.order_edit;
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 * StagedOrderUpdateItemShippingAddressActionBuilder
012 * <hr>
013 * Example to create an instance using the builder pattern
014 * <div class=code-example>
015 * <pre><code class='java'>
016 *     StagedOrderUpdateItemShippingAddressAction stagedOrderUpdateItemShippingAddressAction = StagedOrderUpdateItemShippingAddressAction.builder()
017 *             .address(addressBuilder -> addressBuilder)
018 *             .build()
019 * </code></pre>
020 * </div>
021 */
022@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
023public class StagedOrderUpdateItemShippingAddressActionBuilder
024        implements Builder<StagedOrderUpdateItemShippingAddressAction> {
025
026    private com.commercetools.api.models.common.BaseAddress address;
027
028    /**
029     *  <p>The new Address with the same <code>key</code> as the Address it will replace.</p>
030     * @param builder function to build the address value
031     * @return Builder
032     */
033
034    public StagedOrderUpdateItemShippingAddressActionBuilder address(
035            Function<com.commercetools.api.models.common.BaseAddressBuilder, com.commercetools.api.models.common.BaseAddressBuilder> builder) {
036        this.address = builder.apply(com.commercetools.api.models.common.BaseAddressBuilder.of()).build();
037        return this;
038    }
039
040    /**
041     *  <p>The new Address with the same <code>key</code> as the Address it will replace.</p>
042     * @param builder function to build the address value
043     * @return Builder
044     */
045
046    public StagedOrderUpdateItemShippingAddressActionBuilder withAddress(
047            Function<com.commercetools.api.models.common.BaseAddressBuilder, com.commercetools.api.models.common.BaseAddress> builder) {
048        this.address = builder.apply(com.commercetools.api.models.common.BaseAddressBuilder.of());
049        return this;
050    }
051
052    /**
053     *  <p>The new Address with the same <code>key</code> as the Address it will replace.</p>
054     * @param address value to be set
055     * @return Builder
056     */
057
058    public StagedOrderUpdateItemShippingAddressActionBuilder address(
059            final com.commercetools.api.models.common.BaseAddress address) {
060        this.address = address;
061        return this;
062    }
063
064    /**
065     *  <p>The new Address with the same <code>key</code> as the Address it will replace.</p>
066     * @return address
067     */
068
069    public com.commercetools.api.models.common.BaseAddress getAddress() {
070        return this.address;
071    }
072
073    /**
074     * builds StagedOrderUpdateItemShippingAddressAction with checking for non-null required values
075     * @return StagedOrderUpdateItemShippingAddressAction
076     */
077    public StagedOrderUpdateItemShippingAddressAction build() {
078        Objects.requireNonNull(address, StagedOrderUpdateItemShippingAddressAction.class + ": address is missing");
079        return new StagedOrderUpdateItemShippingAddressActionImpl(address);
080    }
081
082    /**
083     * builds StagedOrderUpdateItemShippingAddressAction without checking for non-null required values
084     * @return StagedOrderUpdateItemShippingAddressAction
085     */
086    public StagedOrderUpdateItemShippingAddressAction buildUnchecked() {
087        return new StagedOrderUpdateItemShippingAddressActionImpl(address);
088    }
089
090    /**
091     * factory method for an instance of StagedOrderUpdateItemShippingAddressActionBuilder
092     * @return builder
093     */
094    public static StagedOrderUpdateItemShippingAddressActionBuilder of() {
095        return new StagedOrderUpdateItemShippingAddressActionBuilder();
096    }
097
098    /**
099     * create builder for StagedOrderUpdateItemShippingAddressAction instance
100     * @param template instance with prefilled values for the builder
101     * @return builder
102     */
103    public static StagedOrderUpdateItemShippingAddressActionBuilder of(
104            final StagedOrderUpdateItemShippingAddressAction template) {
105        StagedOrderUpdateItemShippingAddressActionBuilder builder = new StagedOrderUpdateItemShippingAddressActionBuilder();
106        builder.address = template.getAddress();
107        return builder;
108    }
109
110}