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