001
002package com.commercetools.api.models.me;
003
004import java.time.*;
005import java.util.*;
006import java.util.function.Function;
007
008import javax.annotation.Nullable;
009import javax.validation.Valid;
010import javax.validation.constraints.NotNull;
011
012import com.commercetools.api.models.common.BaseAddress;
013import com.fasterxml.jackson.annotation.*;
014import com.fasterxml.jackson.databind.annotation.*;
015
016import io.vrap.rmf.base.client.utils.Generated;
017
018/**
019 *  <p>Adds an address to a Cart when shipping to multiple addresses is desired.</p>
020 *
021 * <hr>
022 * Example to create an instance using the builder pattern
023 * <div class=code-example>
024 * <pre><code class='java'>
025 *     MyCartAddItemShippingAddressAction myCartAddItemShippingAddressAction = MyCartAddItemShippingAddressAction.builder()
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")
032@JsonDeserialize(as = MyCartAddItemShippingAddressActionImpl.class)
033public interface MyCartAddItemShippingAddressAction extends MyCartUpdateAction {
034
035    /**
036     * discriminator value for MyCartAddItemShippingAddressAction
037     */
038    String ADD_ITEM_SHIPPING_ADDRESS = "addItemShippingAddress";
039
040    /**
041     *  <p>Address to append to <code>itemShippingAddresses</code>.</p>
042     *  <p>The new address must have a key that is unique accross this Cart.</p>
043     * @return address
044     */
045    @NotNull
046    @Valid
047    @JsonProperty("address")
048    public BaseAddress getAddress();
049
050    /**
051     *  <p>Address to append to <code>itemShippingAddresses</code>.</p>
052     *  <p>The new address must have a key that is unique accross this Cart.</p>
053     * @param address value to be set
054     */
055
056    public void setAddress(final BaseAddress address);
057
058    /**
059     * factory method
060     * @return instance of MyCartAddItemShippingAddressAction
061     */
062    public static MyCartAddItemShippingAddressAction of() {
063        return new MyCartAddItemShippingAddressActionImpl();
064    }
065
066    /**
067     * factory method to create a shallow copy MyCartAddItemShippingAddressAction
068     * @param template instance to be copied
069     * @return copy instance
070     */
071    public static MyCartAddItemShippingAddressAction of(final MyCartAddItemShippingAddressAction template) {
072        MyCartAddItemShippingAddressActionImpl instance = new MyCartAddItemShippingAddressActionImpl();
073        instance.setAddress(template.getAddress());
074        return instance;
075    }
076
077    /**
078     * factory method to create a deep copy of MyCartAddItemShippingAddressAction
079     * @param template instance to be copied
080     * @return copy instance
081     */
082    @Nullable
083    public static MyCartAddItemShippingAddressAction deepCopy(
084            @Nullable final MyCartAddItemShippingAddressAction template) {
085        if (template == null) {
086            return null;
087        }
088        MyCartAddItemShippingAddressActionImpl instance = new MyCartAddItemShippingAddressActionImpl();
089        instance.setAddress(com.commercetools.api.models.common.BaseAddress.deepCopy(template.getAddress()));
090        return instance;
091    }
092
093    /**
094     * builder factory method for MyCartAddItemShippingAddressAction
095     * @return builder
096     */
097    public static MyCartAddItemShippingAddressActionBuilder builder() {
098        return MyCartAddItemShippingAddressActionBuilder.of();
099    }
100
101    /**
102     * create builder for MyCartAddItemShippingAddressAction instance
103     * @param template instance with prefilled values for the builder
104     * @return builder
105     */
106    public static MyCartAddItemShippingAddressActionBuilder builder(final MyCartAddItemShippingAddressAction template) {
107        return MyCartAddItemShippingAddressActionBuilder.of(template);
108    }
109
110    /**
111     * accessor map function
112     * @param <T> mapped type
113     * @param helper function to map the object
114     * @return mapped value
115     */
116    default <T> T withMyCartAddItemShippingAddressAction(Function<MyCartAddItemShippingAddressAction, T> helper) {
117        return helper.apply(this);
118    }
119
120    /**
121     * gives a TypeReference for usage with Jackson DataBind
122     * @return TypeReference
123     */
124    public static com.fasterxml.jackson.core.type.TypeReference<MyCartAddItemShippingAddressAction> typeReference() {
125        return new com.fasterxml.jackson.core.type.TypeReference<MyCartAddItemShippingAddressAction>() {
126            @Override
127            public String toString() {
128                return "TypeReference<MyCartAddItemShippingAddressAction>";
129            }
130        };
131    }
132}