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