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.ItemShippingDetails; 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 LineItem ShippingDetails on Orders.</li> 022 * <li>Set LineItem ShippingDetails 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 * SetLineItemShippingDetailsChange setLineItemShippingDetailsChange = SetLineItemShippingDetailsChange.builder() 030 * .change("{change}") 031 * .previousValue(previousValueBuilder -> previousValueBuilder) 032 * .nextValue(nextValueBuilder -> nextValueBuilder) 033 * .lineItemId("{lineItemId}") 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 = SetLineItemShippingDetailsChangeImpl.class) 040public interface SetLineItemShippingDetailsChange extends Change { 041 042 /** 043 * discriminator value for SetLineItemShippingDetailsChange 044 */ 045 String SET_LINE_ITEM_SHIPPING_DETAILS_CHANGE = "SetLineItemShippingDetailsChange"; 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 ItemShippingDetails getPreviousValue(); 071 072 /** 073 * <p>Value after the change.</p> 074 * @return nextValue 075 */ 076 @NotNull 077 @Valid 078 @JsonProperty("nextValue") 079 public ItemShippingDetails getNextValue(); 080 081 /** 082 * <p><code>id</code> of the updated LineItem.</p> 083 * @return lineItemId 084 */ 085 @NotNull 086 @JsonProperty("lineItemId") 087 public String getLineItemId(); 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 ItemShippingDetails previousValue); 102 103 /** 104 * <p>Value after the change.</p> 105 * @param nextValue value to be set 106 */ 107 108 public void setNextValue(final ItemShippingDetails nextValue); 109 110 /** 111 * <p><code>id</code> of the updated LineItem.</p> 112 * @param lineItemId value to be set 113 */ 114 115 public void setLineItemId(final String lineItemId); 116 117 /** 118 * factory method 119 * @return instance of SetLineItemShippingDetailsChange 120 */ 121 public static SetLineItemShippingDetailsChange of() { 122 return new SetLineItemShippingDetailsChangeImpl(); 123 } 124 125 /** 126 * factory method to create a shallow copy SetLineItemShippingDetailsChange 127 * @param template instance to be copied 128 * @return copy instance 129 */ 130 public static SetLineItemShippingDetailsChange of(final SetLineItemShippingDetailsChange template) { 131 SetLineItemShippingDetailsChangeImpl instance = new SetLineItemShippingDetailsChangeImpl(); 132 instance.setChange(template.getChange()); 133 instance.setPreviousValue(template.getPreviousValue()); 134 instance.setNextValue(template.getNextValue()); 135 instance.setLineItemId(template.getLineItemId()); 136 return instance; 137 } 138 139 /** 140 * factory method to create a deep copy of SetLineItemShippingDetailsChange 141 * @param template instance to be copied 142 * @return copy instance 143 */ 144 @Nullable 145 public static SetLineItemShippingDetailsChange deepCopy(@Nullable final SetLineItemShippingDetailsChange template) { 146 if (template == null) { 147 return null; 148 } 149 SetLineItemShippingDetailsChangeImpl instance = new SetLineItemShippingDetailsChangeImpl(); 150 instance.setChange(template.getChange()); 151 instance.setPreviousValue( 152 com.commercetools.history.models.common.ItemShippingDetails.deepCopy(template.getPreviousValue())); 153 instance.setNextValue( 154 com.commercetools.history.models.common.ItemShippingDetails.deepCopy(template.getNextValue())); 155 instance.setLineItemId(template.getLineItemId()); 156 return instance; 157 } 158 159 /** 160 * builder factory method for SetLineItemShippingDetailsChange 161 * @return builder 162 */ 163 public static SetLineItemShippingDetailsChangeBuilder builder() { 164 return SetLineItemShippingDetailsChangeBuilder.of(); 165 } 166 167 /** 168 * create builder for SetLineItemShippingDetailsChange instance 169 * @param template instance with prefilled values for the builder 170 * @return builder 171 */ 172 public static SetLineItemShippingDetailsChangeBuilder builder(final SetLineItemShippingDetailsChange template) { 173 return SetLineItemShippingDetailsChangeBuilder.of(template); 174 } 175 176 /** 177 * accessor map function 178 * @param <T> mapped type 179 * @param helper function to map the object 180 * @return mapped value 181 */ 182 default <T> T withSetLineItemShippingDetailsChange(Function<SetLineItemShippingDetailsChange, T> helper) { 183 return helper.apply(this); 184 } 185 186 /** 187 * gives a TypeReference for usage with Jackson DataBind 188 * @return TypeReference 189 */ 190 public static com.fasterxml.jackson.core.type.TypeReference<SetLineItemShippingDetailsChange> typeReference() { 191 return new com.fasterxml.jackson.core.type.TypeReference<SetLineItemShippingDetailsChange>() { 192 @Override 193 public String toString() { 194 return "TypeReference<SetLineItemShippingDetailsChange>"; 195 } 196 }; 197 } 198}