001 002package com.commercetools.api.models.cart; 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 * CartAddItemShippingAddressAction cartAddItemShippingAddressAction = CartAddItemShippingAddressAction.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 = CartAddItemShippingAddressActionImpl.class) 033public interface CartAddItemShippingAddressAction extends CartUpdateAction { 034 035 /** 036 * discriminator value for CartAddItemShippingAddressAction 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 <code>key</code> 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 <code>key</code> 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 CartAddItemShippingAddressAction 061 */ 062 public static CartAddItemShippingAddressAction of() { 063 return new CartAddItemShippingAddressActionImpl(); 064 } 065 066 /** 067 * factory method to create a shallow copy CartAddItemShippingAddressAction 068 * @param template instance to be copied 069 * @return copy instance 070 */ 071 public static CartAddItemShippingAddressAction of(final CartAddItemShippingAddressAction template) { 072 CartAddItemShippingAddressActionImpl instance = new CartAddItemShippingAddressActionImpl(); 073 instance.setAddress(template.getAddress()); 074 return instance; 075 } 076 077 /** 078 * factory method to create a deep copy of CartAddItemShippingAddressAction 079 * @param template instance to be copied 080 * @return copy instance 081 */ 082 @Nullable 083 public static CartAddItemShippingAddressAction deepCopy(@Nullable final CartAddItemShippingAddressAction template) { 084 if (template == null) { 085 return null; 086 } 087 CartAddItemShippingAddressActionImpl instance = new CartAddItemShippingAddressActionImpl(); 088 instance.setAddress(com.commercetools.api.models.common.BaseAddress.deepCopy(template.getAddress())); 089 return instance; 090 } 091 092 /** 093 * builder factory method for CartAddItemShippingAddressAction 094 * @return builder 095 */ 096 public static CartAddItemShippingAddressActionBuilder builder() { 097 return CartAddItemShippingAddressActionBuilder.of(); 098 } 099 100 /** 101 * create builder for CartAddItemShippingAddressAction instance 102 * @param template instance with prefilled values for the builder 103 * @return builder 104 */ 105 public static CartAddItemShippingAddressActionBuilder builder(final CartAddItemShippingAddressAction template) { 106 return CartAddItemShippingAddressActionBuilder.of(template); 107 } 108 109 /** 110 * accessor map function 111 * @param <T> mapped type 112 * @param helper function to map the object 113 * @return mapped value 114 */ 115 default <T> T withCartAddItemShippingAddressAction(Function<CartAddItemShippingAddressAction, T> helper) { 116 return helper.apply(this); 117 } 118 119 /** 120 * gives a TypeReference for usage with Jackson DataBind 121 * @return TypeReference 122 */ 123 public static com.fasterxml.jackson.core.type.TypeReference<CartAddItemShippingAddressAction> typeReference() { 124 return new com.fasterxml.jackson.core.type.TypeReference<CartAddItemShippingAddressAction>() { 125 @Override 126 public String toString() { 127 return "TypeReference<CartAddItemShippingAddressAction>"; 128 } 129 }; 130 } 131}