001 002package com.commercetools.history.models.change; 003 004import java.time.*; 005import java.util.*; 006import java.util.function.Function; 007import java.util.stream.Collectors; 008 009import javax.annotation.Nullable; 010import javax.validation.Valid; 011import javax.validation.constraints.NotNull; 012 013import com.commercetools.history.models.common.LocalizedString; 014import com.fasterxml.jackson.annotation.*; 015import com.fasterxml.jackson.databind.annotation.*; 016 017import io.vrap.rmf.base.client.utils.Generated; 018 019/** 020 * <p>Change triggered by the following update actions:</p> 021 * <ul> 022 * <li>Change Asset Order on Categories.</li> 023 * <li>Change Asset Order on Products.</li> 024 * </ul> 025 * 026 * <hr> 027 * Example to create an instance using the builder pattern 028 * <div class=code-example> 029 * <pre><code class='java'> 030 * ChangeAssetOrderChange changeAssetOrderChange = ChangeAssetOrderChange.builder() 031 * .change("{change}") 032 * .plusPreviousValue(previousValueBuilder -> previousValueBuilder) 033 * .plusNextValue(nextValueBuilder -> nextValueBuilder) 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 = ChangeAssetOrderChangeImpl.class) 040public interface ChangeAssetOrderChange extends Change { 041 042 /** 043 * discriminator value for ChangeAssetOrderChange 044 */ 045 String CHANGE_ASSET_ORDER_CHANGE = "ChangeAssetOrderChange"; 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 List<LocalizedString> getPreviousValue(); 071 072 /** 073 * <p>Value after the change.</p> 074 * @return nextValue 075 */ 076 @NotNull 077 @Valid 078 @JsonProperty("nextValue") 079 public List<LocalizedString> getNextValue(); 080 081 /** 082 * set change 083 * @param change value to be set 084 */ 085 086 public void setChange(final String change); 087 088 /** 089 * <p>Value before the change.</p> 090 * @param previousValue values to be set 091 */ 092 093 @JsonIgnore 094 public void setPreviousValue(final LocalizedString... previousValue); 095 096 /** 097 * <p>Value before the change.</p> 098 * @param previousValue values to be set 099 */ 100 101 public void setPreviousValue(final List<LocalizedString> previousValue); 102 103 /** 104 * <p>Value after the change.</p> 105 * @param nextValue values to be set 106 */ 107 108 @JsonIgnore 109 public void setNextValue(final LocalizedString... nextValue); 110 111 /** 112 * <p>Value after the change.</p> 113 * @param nextValue values to be set 114 */ 115 116 public void setNextValue(final List<LocalizedString> nextValue); 117 118 /** 119 * factory method 120 * @return instance of ChangeAssetOrderChange 121 */ 122 public static ChangeAssetOrderChange of() { 123 return new ChangeAssetOrderChangeImpl(); 124 } 125 126 /** 127 * factory method to create a shallow copy ChangeAssetOrderChange 128 * @param template instance to be copied 129 * @return copy instance 130 */ 131 public static ChangeAssetOrderChange of(final ChangeAssetOrderChange template) { 132 ChangeAssetOrderChangeImpl instance = new ChangeAssetOrderChangeImpl(); 133 instance.setChange(template.getChange()); 134 instance.setPreviousValue(template.getPreviousValue()); 135 instance.setNextValue(template.getNextValue()); 136 return instance; 137 } 138 139 /** 140 * factory method to create a deep copy of ChangeAssetOrderChange 141 * @param template instance to be copied 142 * @return copy instance 143 */ 144 @Nullable 145 public static ChangeAssetOrderChange deepCopy(@Nullable final ChangeAssetOrderChange template) { 146 if (template == null) { 147 return null; 148 } 149 ChangeAssetOrderChangeImpl instance = new ChangeAssetOrderChangeImpl(); 150 instance.setChange(template.getChange()); 151 instance.setPreviousValue(Optional.ofNullable(template.getPreviousValue()) 152 .map(t -> t.stream() 153 .map(com.commercetools.history.models.common.LocalizedString::deepCopy) 154 .collect(Collectors.toList())) 155 .orElse(null)); 156 instance.setNextValue(Optional.ofNullable(template.getNextValue()) 157 .map(t -> t.stream() 158 .map(com.commercetools.history.models.common.LocalizedString::deepCopy) 159 .collect(Collectors.toList())) 160 .orElse(null)); 161 return instance; 162 } 163 164 /** 165 * builder factory method for ChangeAssetOrderChange 166 * @return builder 167 */ 168 public static ChangeAssetOrderChangeBuilder builder() { 169 return ChangeAssetOrderChangeBuilder.of(); 170 } 171 172 /** 173 * create builder for ChangeAssetOrderChange instance 174 * @param template instance with prefilled values for the builder 175 * @return builder 176 */ 177 public static ChangeAssetOrderChangeBuilder builder(final ChangeAssetOrderChange template) { 178 return ChangeAssetOrderChangeBuilder.of(template); 179 } 180 181 /** 182 * accessor map function 183 * @param <T> mapped type 184 * @param helper function to map the object 185 * @return mapped value 186 */ 187 default <T> T withChangeAssetOrderChange(Function<ChangeAssetOrderChange, T> helper) { 188 return helper.apply(this); 189 } 190 191 /** 192 * gives a TypeReference for usage with Jackson DataBind 193 * @return TypeReference 194 */ 195 public static com.fasterxml.jackson.core.type.TypeReference<ChangeAssetOrderChange> typeReference() { 196 return new com.fasterxml.jackson.core.type.TypeReference<ChangeAssetOrderChange>() { 197 @Override 198 public String toString() { 199 return "TypeReference<ChangeAssetOrderChange>"; 200 } 201 }; 202 } 203}