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.change_value.AssetChangeValue; 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 Asset Key on Categories.</li> 022 * <li>Set Asset Key on Products.</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 * SetAssetKeyChange setAssetKeyChange = SetAssetKeyChange.builder() 030 * .change("{change}") 031 * .previousValue("{previousValue}") 032 * .nextValue("{nextValue}") 033 * .asset(assetBuilder -> assetBuilder) 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 = SetAssetKeyChangeImpl.class) 040public interface SetAssetKeyChange extends Change { 041 042 /** 043 * discriminator value for SetAssetKeyChange 044 */ 045 String SET_ASSET_KEY_CHANGE = "SetAssetKeyChange"; 046 047 /** 048 * 049 * @return change 050 */ 051 @NotNull 052 @JsonProperty("change") 053 public String getChange(); 054 055 /** 056 * 057 * @return type 058 */ 059 @NotNull 060 @JsonProperty("type") 061 public String getType(); 062 063 /** 064 * <p>Value before the change.</p> 065 * @return previousValue 066 */ 067 @NotNull 068 @JsonProperty("previousValue") 069 public String getPreviousValue(); 070 071 /** 072 * <p>Value after the change.</p> 073 * @return nextValue 074 */ 075 @NotNull 076 @JsonProperty("nextValue") 077 public String getNextValue(); 078 079 /** 080 * <p>Information about the updated Asset.</p> 081 * @return asset 082 */ 083 @NotNull 084 @Valid 085 @JsonProperty("asset") 086 public AssetChangeValue getAsset(); 087 088 /** 089 * set change 090 * @param change value to be set 091 */ 092 093 public void setChange(final String change); 094 095 /** 096 * <p>Value before the change.</p> 097 * @param previousValue value to be set 098 */ 099 100 public void setPreviousValue(final String previousValue); 101 102 /** 103 * <p>Value after the change.</p> 104 * @param nextValue value to be set 105 */ 106 107 public void setNextValue(final String nextValue); 108 109 /** 110 * <p>Information about the updated Asset.</p> 111 * @param asset value to be set 112 */ 113 114 public void setAsset(final AssetChangeValue asset); 115 116 /** 117 * factory method 118 * @return instance of SetAssetKeyChange 119 */ 120 public static SetAssetKeyChange of() { 121 return new SetAssetKeyChangeImpl(); 122 } 123 124 /** 125 * factory method to create a shallow copy SetAssetKeyChange 126 * @param template instance to be copied 127 * @return copy instance 128 */ 129 public static SetAssetKeyChange of(final SetAssetKeyChange template) { 130 SetAssetKeyChangeImpl instance = new SetAssetKeyChangeImpl(); 131 instance.setChange(template.getChange()); 132 instance.setPreviousValue(template.getPreviousValue()); 133 instance.setNextValue(template.getNextValue()); 134 instance.setAsset(template.getAsset()); 135 return instance; 136 } 137 138 /** 139 * factory method to create a deep copy of SetAssetKeyChange 140 * @param template instance to be copied 141 * @return copy instance 142 */ 143 @Nullable 144 public static SetAssetKeyChange deepCopy(@Nullable final SetAssetKeyChange template) { 145 if (template == null) { 146 return null; 147 } 148 SetAssetKeyChangeImpl instance = new SetAssetKeyChangeImpl(); 149 instance.setChange(template.getChange()); 150 instance.setPreviousValue(template.getPreviousValue()); 151 instance.setNextValue(template.getNextValue()); 152 instance.setAsset(com.commercetools.history.models.change_value.AssetChangeValue.deepCopy(template.getAsset())); 153 return instance; 154 } 155 156 /** 157 * builder factory method for SetAssetKeyChange 158 * @return builder 159 */ 160 public static SetAssetKeyChangeBuilder builder() { 161 return SetAssetKeyChangeBuilder.of(); 162 } 163 164 /** 165 * create builder for SetAssetKeyChange instance 166 * @param template instance with prefilled values for the builder 167 * @return builder 168 */ 169 public static SetAssetKeyChangeBuilder builder(final SetAssetKeyChange template) { 170 return SetAssetKeyChangeBuilder.of(template); 171 } 172 173 /** 174 * accessor map function 175 * @param <T> mapped type 176 * @param helper function to map the object 177 * @return mapped value 178 */ 179 default <T> T withSetAssetKeyChange(Function<SetAssetKeyChange, T> helper) { 180 return helper.apply(this); 181 } 182 183 /** 184 * gives a TypeReference for usage with Jackson DataBind 185 * @return TypeReference 186 */ 187 public static com.fasterxml.jackson.core.type.TypeReference<SetAssetKeyChange> typeReference() { 188 return new com.fasterxml.jackson.core.type.TypeReference<SetAssetKeyChange>() { 189 @Override 190 public String toString() { 191 return "TypeReference<SetAssetKeyChange>"; 192 } 193 }; 194 } 195}