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 following update actions:</p> 020 * <ul> 021 * <li>Set DeliveryAddress on Orders.</li> 022 * <li>Set DeliveryAddress on Staged Orders.</li> 023 * </ul> 024 * 025 * <hr> 026 * Example to create an instance using the builder pattern 027 * <div class=code-example> 028 * <pre><code class='java'> 029 * SetDeliveryAddressChange setDeliveryAddressChange = SetDeliveryAddressChange.builder() 030 * .change("{change}") 031 * .previousValue(previousValueBuilder -> previousValueBuilder) 032 * .nextValue(nextValueBuilder -> nextValueBuilder) 033 * .deliveryId("{deliveryId}") 034 * .build() 035 * </code></pre> 036 * </div> 037 */ 038@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen") 039@JsonDeserialize(as = SetDeliveryAddressChangeImpl.class) 040public interface SetDeliveryAddressChange extends Change { 041 042 /** 043 * discriminator value for SetDeliveryAddressChange 044 */ 045 String SET_DELIVERY_ADDRESS_CHANGE = "SetDeliveryAddressChange"; 046 047 /** 048 * 049 * @return type 050 */ 051 @NotNull 052 @JsonProperty("type") 053 public String getType(); 054 055 /** 056 * 057 * @return change 058 */ 059 @NotNull 060 @JsonProperty("change") 061 public String getChange(); 062 063 /** 064 * <p>Value before the change.</p> 065 * @return previousValue 066 */ 067 @NotNull 068 @Valid 069 @JsonProperty("previousValue") 070 public Address getPreviousValue(); 071 072 /** 073 * <p>Value after the change.</p> 074 * @return nextValue 075 */ 076 @NotNull 077 @Valid 078 @JsonProperty("nextValue") 079 public Address getNextValue(); 080 081 /** 082 * <p><code>id</code> of the updated Delivery.</p> 083 * @return deliveryId 084 */ 085 @NotNull 086 @JsonProperty("deliveryId") 087 public String getDeliveryId(); 088 089 /** 090 * set change 091 * @param change value to be set 092 */ 093 094 public void setChange(final String change); 095 096 /** 097 * <p>Value before the change.</p> 098 * @param previousValue value to be set 099 */ 100 101 public void setPreviousValue(final Address previousValue); 102 103 /** 104 * <p>Value after the change.</p> 105 * @param nextValue value to be set 106 */ 107 108 public void setNextValue(final Address nextValue); 109 110 /** 111 * <p><code>id</code> of the updated Delivery.</p> 112 * @param deliveryId value to be set 113 */ 114 115 public void setDeliveryId(final String deliveryId); 116 117 /** 118 * factory method 119 * @return instance of SetDeliveryAddressChange 120 */ 121 public static SetDeliveryAddressChange of() { 122 return new SetDeliveryAddressChangeImpl(); 123 } 124 125 /** 126 * factory method to create a shallow copy SetDeliveryAddressChange 127 * @param template instance to be copied 128 * @return copy instance 129 */ 130 public static SetDeliveryAddressChange of(final SetDeliveryAddressChange template) { 131 SetDeliveryAddressChangeImpl instance = new SetDeliveryAddressChangeImpl(); 132 instance.setChange(template.getChange()); 133 instance.setPreviousValue(template.getPreviousValue()); 134 instance.setNextValue(template.getNextValue()); 135 instance.setDeliveryId(template.getDeliveryId()); 136 return instance; 137 } 138 139 /** 140 * factory method to create a deep copy of SetDeliveryAddressChange 141 * @param template instance to be copied 142 * @return copy instance 143 */ 144 @Nullable 145 public static SetDeliveryAddressChange deepCopy(@Nullable final SetDeliveryAddressChange template) { 146 if (template == null) { 147 return null; 148 } 149 SetDeliveryAddressChangeImpl instance = new SetDeliveryAddressChangeImpl(); 150 instance.setChange(template.getChange()); 151 instance.setPreviousValue( 152 com.commercetools.history.models.common.Address.deepCopy(template.getPreviousValue())); 153 instance.setNextValue(com.commercetools.history.models.common.Address.deepCopy(template.getNextValue())); 154 instance.setDeliveryId(template.getDeliveryId()); 155 return instance; 156 } 157 158 /** 159 * builder factory method for SetDeliveryAddressChange 160 * @return builder 161 */ 162 public static SetDeliveryAddressChangeBuilder builder() { 163 return SetDeliveryAddressChangeBuilder.of(); 164 } 165 166 /** 167 * create builder for SetDeliveryAddressChange instance 168 * @param template instance with prefilled values for the builder 169 * @return builder 170 */ 171 public static SetDeliveryAddressChangeBuilder builder(final SetDeliveryAddressChange template) { 172 return SetDeliveryAddressChangeBuilder.of(template); 173 } 174 175 /** 176 * accessor map function 177 * @param <T> mapped type 178 * @param helper function to map the object 179 * @return mapped value 180 */ 181 default <T> T withSetDeliveryAddressChange(Function<SetDeliveryAddressChange, T> helper) { 182 return helper.apply(this); 183 } 184 185 /** 186 * gives a TypeReference for usage with Jackson DataBind 187 * @return TypeReference 188 */ 189 public static com.fasterxml.jackson.core.type.TypeReference<SetDeliveryAddressChange> typeReference() { 190 return new com.fasterxml.jackson.core.type.TypeReference<SetDeliveryAddressChange>() { 191 @Override 192 public String toString() { 193 return "TypeReference<SetDeliveryAddressChange>"; 194 } 195 }; 196 } 197}