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>Change Asset Tags on Categories.</li> 022 * <li>Change Asset Tags 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 * SetAssetTagsChange setAssetTagsChange = SetAssetTagsChange.builder() 030 * .change("{change}") 031 * .plusPreviousValue(previousValueBuilder -> previousValueBuilder) 032 * .plusNextValue(nextValueBuilder -> nextValueBuilder) 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 = SetAssetTagsChangeImpl.class) 040public interface SetAssetTagsChange extends Change { 041 042 /** 043 * discriminator value for SetAssetTagsChange 044 */ 045 String SET_ASSET_TAGS_CHANGE = "SetAssetTagsChange"; 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 List<String> getPreviousValue(); 070 071 /** 072 * <p>Value after the change.</p> 073 * @return nextValue 074 */ 075 @NotNull 076 @JsonProperty("nextValue") 077 public List<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 values to be set 098 */ 099 100 @JsonIgnore 101 public void setPreviousValue(final String... previousValue); 102 103 /** 104 * <p>Value before the change.</p> 105 * @param previousValue values to be set 106 */ 107 108 public void setPreviousValue(final List<String> previousValue); 109 110 /** 111 * <p>Value after the change.</p> 112 * @param nextValue values to be set 113 */ 114 115 @JsonIgnore 116 public void setNextValue(final String... nextValue); 117 118 /** 119 * <p>Value after the change.</p> 120 * @param nextValue values to be set 121 */ 122 123 public void setNextValue(final List<String> nextValue); 124 125 /** 126 * <p>Information about the updated Asset.</p> 127 * @param asset value to be set 128 */ 129 130 public void setAsset(final AssetChangeValue asset); 131 132 /** 133 * factory method 134 * @return instance of SetAssetTagsChange 135 */ 136 public static SetAssetTagsChange of() { 137 return new SetAssetTagsChangeImpl(); 138 } 139 140 /** 141 * factory method to create a shallow copy SetAssetTagsChange 142 * @param template instance to be copied 143 * @return copy instance 144 */ 145 public static SetAssetTagsChange of(final SetAssetTagsChange template) { 146 SetAssetTagsChangeImpl instance = new SetAssetTagsChangeImpl(); 147 instance.setChange(template.getChange()); 148 instance.setPreviousValue(template.getPreviousValue()); 149 instance.setNextValue(template.getNextValue()); 150 instance.setAsset(template.getAsset()); 151 return instance; 152 } 153 154 /** 155 * factory method to create a deep copy of SetAssetTagsChange 156 * @param template instance to be copied 157 * @return copy instance 158 */ 159 @Nullable 160 public static SetAssetTagsChange deepCopy(@Nullable final SetAssetTagsChange template) { 161 if (template == null) { 162 return null; 163 } 164 SetAssetTagsChangeImpl instance = new SetAssetTagsChangeImpl(); 165 instance.setChange(template.getChange()); 166 instance.setPreviousValue(Optional.ofNullable(template.getPreviousValue()).map(ArrayList::new).orElse(null)); 167 instance.setNextValue(Optional.ofNullable(template.getNextValue()).map(ArrayList::new).orElse(null)); 168 instance.setAsset(com.commercetools.history.models.change_value.AssetChangeValue.deepCopy(template.getAsset())); 169 return instance; 170 } 171 172 /** 173 * builder factory method for SetAssetTagsChange 174 * @return builder 175 */ 176 public static SetAssetTagsChangeBuilder builder() { 177 return SetAssetTagsChangeBuilder.of(); 178 } 179 180 /** 181 * create builder for SetAssetTagsChange instance 182 * @param template instance with prefilled values for the builder 183 * @return builder 184 */ 185 public static SetAssetTagsChangeBuilder builder(final SetAssetTagsChange template) { 186 return SetAssetTagsChangeBuilder.of(template); 187 } 188 189 /** 190 * accessor map function 191 * @param <T> mapped type 192 * @param helper function to map the object 193 * @return mapped value 194 */ 195 default <T> T withSetAssetTagsChange(Function<SetAssetTagsChange, T> helper) { 196 return helper.apply(this); 197 } 198 199 /** 200 * gives a TypeReference for usage with Jackson DataBind 201 * @return TypeReference 202 */ 203 public static com.fasterxml.jackson.core.type.TypeReference<SetAssetTagsChange> typeReference() { 204 return new com.fasterxml.jackson.core.type.TypeReference<SetAssetTagsChange>() { 205 @Override 206 public String toString() { 207 return "TypeReference<SetAssetTagsChange>"; 208 } 209 }; 210 } 211}