001 002package com.commercetools.history.models.change; 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.history.models.common.Address; 013import com.fasterxml.jackson.annotation.*; 014import com.fasterxml.jackson.databind.annotation.*; 015 016import io.vrap.rmf.base.client.utils.Generated; 017 018/** 019 * <p>Change triggered by the Add Shipping Address ID update action.</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 * AddShippingAddressIdChange addShippingAddressIdChange = AddShippingAddressIdChange.builder() 026 * .change("{change}") 027 * .plusPreviousValue(previousValueBuilder -> previousValueBuilder) 028 * .plusNextValue(nextValueBuilder -> nextValueBuilder) 029 * .address(addressBuilder -> addressBuilder) 030 * .build() 031 * </code></pre> 032 * </div> 033 */ 034@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen") 035@JsonDeserialize(as = AddShippingAddressIdChangeImpl.class) 036public interface AddShippingAddressIdChange extends Change { 037 038 /** 039 * discriminator value for AddShippingAddressIdChange 040 */ 041 String ADD_SHIPPING_ADDRESS_ID_CHANGE = "AddShippingAddressIdChange"; 042 043 /** 044 * 045 * @return change 046 */ 047 @NotNull 048 @JsonProperty("change") 049 public String getChange(); 050 051 /** 052 * 053 * @return type 054 */ 055 @NotNull 056 @JsonProperty("type") 057 public String getType(); 058 059 /** 060 * <p>Value before the change.</p> 061 * @return previousValue 062 */ 063 @NotNull 064 @JsonProperty("previousValue") 065 public List<String> getPreviousValue(); 066 067 /** 068 * <p>Value after the change.</p> 069 * @return nextValue 070 */ 071 @NotNull 072 @JsonProperty("nextValue") 073 public List<String> getNextValue(); 074 075 /** 076 * <p>Address added to <code>shippingAddressIds</code>.</p> 077 * @return address 078 */ 079 @NotNull 080 @Valid 081 @JsonProperty("address") 082 public Address getAddress(); 083 084 /** 085 * set change 086 * @param change value to be set 087 */ 088 089 public void setChange(final String change); 090 091 /** 092 * <p>Value before the change.</p> 093 * @param previousValue values to be set 094 */ 095 096 @JsonIgnore 097 public void setPreviousValue(final String... previousValue); 098 099 /** 100 * <p>Value before the change.</p> 101 * @param previousValue values to be set 102 */ 103 104 public void setPreviousValue(final List<String> previousValue); 105 106 /** 107 * <p>Value after the change.</p> 108 * @param nextValue values to be set 109 */ 110 111 @JsonIgnore 112 public void setNextValue(final String... nextValue); 113 114 /** 115 * <p>Value after the change.</p> 116 * @param nextValue values to be set 117 */ 118 119 public void setNextValue(final List<String> nextValue); 120 121 /** 122 * <p>Address added to <code>shippingAddressIds</code>.</p> 123 * @param address value to be set 124 */ 125 126 public void setAddress(final Address address); 127 128 /** 129 * factory method 130 * @return instance of AddShippingAddressIdChange 131 */ 132 public static AddShippingAddressIdChange of() { 133 return new AddShippingAddressIdChangeImpl(); 134 } 135 136 /** 137 * factory method to create a shallow copy AddShippingAddressIdChange 138 * @param template instance to be copied 139 * @return copy instance 140 */ 141 public static AddShippingAddressIdChange of(final AddShippingAddressIdChange template) { 142 AddShippingAddressIdChangeImpl instance = new AddShippingAddressIdChangeImpl(); 143 instance.setChange(template.getChange()); 144 instance.setPreviousValue(template.getPreviousValue()); 145 instance.setNextValue(template.getNextValue()); 146 instance.setAddress(template.getAddress()); 147 return instance; 148 } 149 150 /** 151 * factory method to create a deep copy of AddShippingAddressIdChange 152 * @param template instance to be copied 153 * @return copy instance 154 */ 155 @Nullable 156 public static AddShippingAddressIdChange deepCopy(@Nullable final AddShippingAddressIdChange template) { 157 if (template == null) { 158 return null; 159 } 160 AddShippingAddressIdChangeImpl instance = new AddShippingAddressIdChangeImpl(); 161 instance.setChange(template.getChange()); 162 instance.setPreviousValue(Optional.ofNullable(template.getPreviousValue()).map(ArrayList::new).orElse(null)); 163 instance.setNextValue(Optional.ofNullable(template.getNextValue()).map(ArrayList::new).orElse(null)); 164 instance.setAddress(com.commercetools.history.models.common.Address.deepCopy(template.getAddress())); 165 return instance; 166 } 167 168 /** 169 * builder factory method for AddShippingAddressIdChange 170 * @return builder 171 */ 172 public static AddShippingAddressIdChangeBuilder builder() { 173 return AddShippingAddressIdChangeBuilder.of(); 174 } 175 176 /** 177 * create builder for AddShippingAddressIdChange instance 178 * @param template instance with prefilled values for the builder 179 * @return builder 180 */ 181 public static AddShippingAddressIdChangeBuilder builder(final AddShippingAddressIdChange template) { 182 return AddShippingAddressIdChangeBuilder.of(template); 183 } 184 185 /** 186 * accessor map function 187 * @param <T> mapped type 188 * @param helper function to map the object 189 * @return mapped value 190 */ 191 default <T> T withAddShippingAddressIdChange(Function<AddShippingAddressIdChange, T> helper) { 192 return helper.apply(this); 193 } 194 195 /** 196 * gives a TypeReference for usage with Jackson DataBind 197 * @return TypeReference 198 */ 199 public static com.fasterxml.jackson.core.type.TypeReference<AddShippingAddressIdChange> typeReference() { 200 return new com.fasterxml.jackson.core.type.TypeReference<AddShippingAddressIdChange>() { 201 @Override 202 public String toString() { 203 return "TypeReference<AddShippingAddressIdChange>"; 204 } 205 }; 206 } 207}