001 002package com.commercetools.history.models.common; 003 004import java.time.*; 005import java.util.*; 006import java.util.function.Function; 007 008import javax.annotation.Nullable; 009import javax.validation.constraints.NotNull; 010 011import com.fasterxml.jackson.annotation.*; 012import com.fasterxml.jackson.databind.annotation.*; 013 014import io.vrap.rmf.base.client.utils.Generated; 015 016/** 017 * ItemShippingTarget 018 * 019 * <hr> 020 * Example to create an instance using the builder pattern 021 * <div class=code-example> 022 * <pre><code class='java'> 023 * ItemShippingTarget itemShippingTarget = ItemShippingTarget.builder() 024 * .addressKey("{addressKey}") 025 * .quantity(1) 026 * .build() 027 * </code></pre> 028 * </div> 029 */ 030@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen") 031@JsonDeserialize(as = ItemShippingTargetImpl.class) 032public interface ItemShippingTarget { 033 034 /** 035 * <p>The key of the address in the cart's <code>itemShippingAddresses</code></p> 036 * @return addressKey 037 */ 038 @NotNull 039 @JsonProperty("addressKey") 040 public String getAddressKey(); 041 042 /** 043 * <p>The quantity of items that should go to the address with the specified <code>addressKey</code>. Only positive values are allowed. Using <code>0</code> as quantity is also possible in a draft object, but the element will not be present in the resulting ItemShippingDetails.</p> 044 * @return quantity 045 */ 046 @NotNull 047 @JsonProperty("quantity") 048 public Integer getQuantity(); 049 050 /** 051 * <p>The key of the address in the cart's <code>itemShippingAddresses</code></p> 052 * @param addressKey value to be set 053 */ 054 055 public void setAddressKey(final String addressKey); 056 057 /** 058 * <p>The quantity of items that should go to the address with the specified <code>addressKey</code>. Only positive values are allowed. Using <code>0</code> as quantity is also possible in a draft object, but the element will not be present in the resulting ItemShippingDetails.</p> 059 * @param quantity value to be set 060 */ 061 062 public void setQuantity(final Integer quantity); 063 064 /** 065 * factory method 066 * @return instance of ItemShippingTarget 067 */ 068 public static ItemShippingTarget of() { 069 return new ItemShippingTargetImpl(); 070 } 071 072 /** 073 * factory method to create a shallow copy ItemShippingTarget 074 * @param template instance to be copied 075 * @return copy instance 076 */ 077 public static ItemShippingTarget of(final ItemShippingTarget template) { 078 ItemShippingTargetImpl instance = new ItemShippingTargetImpl(); 079 instance.setAddressKey(template.getAddressKey()); 080 instance.setQuantity(template.getQuantity()); 081 return instance; 082 } 083 084 /** 085 * factory method to create a deep copy of ItemShippingTarget 086 * @param template instance to be copied 087 * @return copy instance 088 */ 089 @Nullable 090 public static ItemShippingTarget deepCopy(@Nullable final ItemShippingTarget template) { 091 if (template == null) { 092 return null; 093 } 094 ItemShippingTargetImpl instance = new ItemShippingTargetImpl(); 095 instance.setAddressKey(template.getAddressKey()); 096 instance.setQuantity(template.getQuantity()); 097 return instance; 098 } 099 100 /** 101 * builder factory method for ItemShippingTarget 102 * @return builder 103 */ 104 public static ItemShippingTargetBuilder builder() { 105 return ItemShippingTargetBuilder.of(); 106 } 107 108 /** 109 * create builder for ItemShippingTarget instance 110 * @param template instance with prefilled values for the builder 111 * @return builder 112 */ 113 public static ItemShippingTargetBuilder builder(final ItemShippingTarget template) { 114 return ItemShippingTargetBuilder.of(template); 115 } 116 117 /** 118 * accessor map function 119 * @param <T> mapped type 120 * @param helper function to map the object 121 * @return mapped value 122 */ 123 default <T> T withItemShippingTarget(Function<ItemShippingTarget, T> helper) { 124 return helper.apply(this); 125 } 126 127 /** 128 * gives a TypeReference for usage with Jackson DataBind 129 * @return TypeReference 130 */ 131 public static com.fasterxml.jackson.core.type.TypeReference<ItemShippingTarget> typeReference() { 132 return new com.fasterxml.jackson.core.type.TypeReference<ItemShippingTarget>() { 133 @Override 134 public String toString() { 135 return "TypeReference<ItemShippingTarget>"; 136 } 137 }; 138 } 139}