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