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.LocalizedString; 013import com.fasterxml.jackson.annotation.*; 014import com.fasterxml.jackson.databind.annotation.*; 015 016import io.vrap.rmf.base.client.utils.Generated; 017 018/** 019 * SetLineItemProductKeyChange 020 * 021 * <hr> 022 * Example to create an instance using the builder pattern 023 * <div class=code-example> 024 * <pre><code class='java'> 025 * SetLineItemProductKeyChange setLineItemProductKeyChange = SetLineItemProductKeyChange.builder() 026 * .change("{change}") 027 * .previousValue("{previousValue}") 028 * .nextValue("{nextValue}") 029 * .lineItem(lineItemBuilder -> lineItemBuilder) 030 * .lineItemId("{lineItemId}") 031 * .variant("{variant}") 032 * .build() 033 * </code></pre> 034 * </div> 035 */ 036@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen") 037@JsonDeserialize(as = SetLineItemProductKeyChangeImpl.class) 038public interface SetLineItemProductKeyChange extends Change { 039 040 /** 041 * discriminator value for SetLineItemProductKeyChange 042 */ 043 String SET_LINE_ITEM_PRODUCT_KEY_CHANGE = "SetLineItemProductKeyChange"; 044 045 /** 046 * 047 * @return type 048 */ 049 @NotNull 050 @JsonProperty("type") 051 public String getType(); 052 053 /** 054 * 055 * @return change 056 */ 057 @NotNull 058 @JsonProperty("change") 059 public String getChange(); 060 061 /** 062 * <p>Value before the change.</p> 063 * @return previousValue 064 */ 065 @NotNull 066 @JsonProperty("previousValue") 067 public String getPreviousValue(); 068 069 /** 070 * <p>Value after the change.</p> 071 * @return nextValue 072 */ 073 @NotNull 074 @JsonProperty("nextValue") 075 public String getNextValue(); 076 077 /** 078 * <p>Name of the Product the Line Item is based on.</p> 079 * @return lineItem 080 */ 081 @NotNull 082 @Valid 083 @JsonProperty("lineItem") 084 public LocalizedString getLineItem(); 085 086 /** 087 * <p><code>id</code> of the updated LineItem.</p> 088 * @return lineItemId 089 */ 090 @NotNull 091 @JsonProperty("lineItemId") 092 public String getLineItemId(); 093 094 /** 095 * <p><code>sku</code> or <code>key</code> of the updated ProductVariant.</p> 096 * @return variant 097 */ 098 @NotNull 099 @JsonProperty("variant") 100 public String getVariant(); 101 102 /** 103 * set change 104 * @param change value to be set 105 */ 106 107 public void setChange(final String change); 108 109 /** 110 * <p>Value before the change.</p> 111 * @param previousValue value to be set 112 */ 113 114 public void setPreviousValue(final String previousValue); 115 116 /** 117 * <p>Value after the change.</p> 118 * @param nextValue value to be set 119 */ 120 121 public void setNextValue(final String nextValue); 122 123 /** 124 * <p>Name of the Product the Line Item is based on.</p> 125 * @param lineItem value to be set 126 */ 127 128 public void setLineItem(final LocalizedString lineItem); 129 130 /** 131 * <p><code>id</code> of the updated LineItem.</p> 132 * @param lineItemId value to be set 133 */ 134 135 public void setLineItemId(final String lineItemId); 136 137 /** 138 * <p><code>sku</code> or <code>key</code> of the updated ProductVariant.</p> 139 * @param variant value to be set 140 */ 141 142 public void setVariant(final String variant); 143 144 /** 145 * factory method 146 * @return instance of SetLineItemProductKeyChange 147 */ 148 public static SetLineItemProductKeyChange of() { 149 return new SetLineItemProductKeyChangeImpl(); 150 } 151 152 /** 153 * factory method to create a shallow copy SetLineItemProductKeyChange 154 * @param template instance to be copied 155 * @return copy instance 156 */ 157 public static SetLineItemProductKeyChange of(final SetLineItemProductKeyChange template) { 158 SetLineItemProductKeyChangeImpl instance = new SetLineItemProductKeyChangeImpl(); 159 instance.setChange(template.getChange()); 160 instance.setPreviousValue(template.getPreviousValue()); 161 instance.setNextValue(template.getNextValue()); 162 instance.setLineItem(template.getLineItem()); 163 instance.setLineItemId(template.getLineItemId()); 164 instance.setVariant(template.getVariant()); 165 return instance; 166 } 167 168 /** 169 * factory method to create a deep copy of SetLineItemProductKeyChange 170 * @param template instance to be copied 171 * @return copy instance 172 */ 173 @Nullable 174 public static SetLineItemProductKeyChange deepCopy(@Nullable final SetLineItemProductKeyChange template) { 175 if (template == null) { 176 return null; 177 } 178 SetLineItemProductKeyChangeImpl instance = new SetLineItemProductKeyChangeImpl(); 179 instance.setChange(template.getChange()); 180 instance.setPreviousValue(template.getPreviousValue()); 181 instance.setNextValue(template.getNextValue()); 182 instance.setLineItem(com.commercetools.history.models.common.LocalizedString.deepCopy(template.getLineItem())); 183 instance.setLineItemId(template.getLineItemId()); 184 instance.setVariant(template.getVariant()); 185 return instance; 186 } 187 188 /** 189 * builder factory method for SetLineItemProductKeyChange 190 * @return builder 191 */ 192 public static SetLineItemProductKeyChangeBuilder builder() { 193 return SetLineItemProductKeyChangeBuilder.of(); 194 } 195 196 /** 197 * create builder for SetLineItemProductKeyChange instance 198 * @param template instance with prefilled values for the builder 199 * @return builder 200 */ 201 public static SetLineItemProductKeyChangeBuilder builder(final SetLineItemProductKeyChange template) { 202 return SetLineItemProductKeyChangeBuilder.of(template); 203 } 204 205 /** 206 * accessor map function 207 * @param <T> mapped type 208 * @param helper function to map the object 209 * @return mapped value 210 */ 211 default <T> T withSetLineItemProductKeyChange(Function<SetLineItemProductKeyChange, T> helper) { 212 return helper.apply(this); 213 } 214 215 /** 216 * gives a TypeReference for usage with Jackson DataBind 217 * @return TypeReference 218 */ 219 public static com.fasterxml.jackson.core.type.TypeReference<SetLineItemProductKeyChange> typeReference() { 220 return new com.fasterxml.jackson.core.type.TypeReference<SetLineItemProductKeyChange>() { 221 @Override 222 public String toString() { 223 return "TypeReference<SetLineItemProductKeyChange>"; 224 } 225 }; 226 } 227}