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.change_value.EnumValue; 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 Change the order of EnumValues update action.</p> 021 * 022 * <hr> 023 * Example to create an instance using the builder pattern 024 * <div class=code-example> 025 * <pre><code class='java'> 026 * ChangePlainEnumValueOrderChange changePlainEnumValueOrderChange = ChangePlainEnumValueOrderChange.builder() 027 * .change("{change}") 028 * .plusPreviousValue(previousValueBuilder -> previousValueBuilder) 029 * .plusNextValue(nextValueBuilder -> nextValueBuilder) 030 * .attributeName("{attributeName}") 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 = ChangePlainEnumValueOrderChangeImpl.class) 037public interface ChangePlainEnumValueOrderChange extends Change { 038 039 /** 040 * discriminator value for ChangePlainEnumValueOrderChange 041 */ 042 String CHANGE_PLAIN_ENUM_VALUE_ORDER_CHANGE = "ChangePlainEnumValueOrderChange"; 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 List<EnumValue> getPreviousValue(); 068 069 /** 070 * <p>Value after the change.</p> 071 * @return nextValue 072 */ 073 @NotNull 074 @Valid 075 @JsonProperty("nextValue") 076 public List<EnumValue> getNextValue(); 077 078 /** 079 * <p>Name of the updated AttributeDefinition.</p> 080 * @return attributeName 081 */ 082 @NotNull 083 @JsonProperty("attributeName") 084 public String getAttributeName(); 085 086 /** 087 * set change 088 * @param change value to be set 089 */ 090 091 public void setChange(final String change); 092 093 /** 094 * <p>Value before the change.</p> 095 * @param previousValue values to be set 096 */ 097 098 @JsonIgnore 099 public void setPreviousValue(final EnumValue... previousValue); 100 101 /** 102 * <p>Value before the change.</p> 103 * @param previousValue values to be set 104 */ 105 106 public void setPreviousValue(final List<EnumValue> previousValue); 107 108 /** 109 * <p>Value after the change.</p> 110 * @param nextValue values to be set 111 */ 112 113 @JsonIgnore 114 public void setNextValue(final EnumValue... nextValue); 115 116 /** 117 * <p>Value after the change.</p> 118 * @param nextValue values to be set 119 */ 120 121 public void setNextValue(final List<EnumValue> nextValue); 122 123 /** 124 * <p>Name of the updated AttributeDefinition.</p> 125 * @param attributeName value to be set 126 */ 127 128 public void setAttributeName(final String attributeName); 129 130 /** 131 * factory method 132 * @return instance of ChangePlainEnumValueOrderChange 133 */ 134 public static ChangePlainEnumValueOrderChange of() { 135 return new ChangePlainEnumValueOrderChangeImpl(); 136 } 137 138 /** 139 * factory method to create a shallow copy ChangePlainEnumValueOrderChange 140 * @param template instance to be copied 141 * @return copy instance 142 */ 143 public static ChangePlainEnumValueOrderChange of(final ChangePlainEnumValueOrderChange template) { 144 ChangePlainEnumValueOrderChangeImpl instance = new ChangePlainEnumValueOrderChangeImpl(); 145 instance.setChange(template.getChange()); 146 instance.setPreviousValue(template.getPreviousValue()); 147 instance.setNextValue(template.getNextValue()); 148 instance.setAttributeName(template.getAttributeName()); 149 return instance; 150 } 151 152 /** 153 * factory method to create a deep copy of ChangePlainEnumValueOrderChange 154 * @param template instance to be copied 155 * @return copy instance 156 */ 157 @Nullable 158 public static ChangePlainEnumValueOrderChange deepCopy(@Nullable final ChangePlainEnumValueOrderChange template) { 159 if (template == null) { 160 return null; 161 } 162 ChangePlainEnumValueOrderChangeImpl instance = new ChangePlainEnumValueOrderChangeImpl(); 163 instance.setChange(template.getChange()); 164 instance.setPreviousValue(Optional.ofNullable(template.getPreviousValue()) 165 .map(t -> t.stream() 166 .map(com.commercetools.history.models.change_value.EnumValue::deepCopy) 167 .collect(Collectors.toList())) 168 .orElse(null)); 169 instance.setNextValue(Optional.ofNullable(template.getNextValue()) 170 .map(t -> t.stream() 171 .map(com.commercetools.history.models.change_value.EnumValue::deepCopy) 172 .collect(Collectors.toList())) 173 .orElse(null)); 174 instance.setAttributeName(template.getAttributeName()); 175 return instance; 176 } 177 178 /** 179 * builder factory method for ChangePlainEnumValueOrderChange 180 * @return builder 181 */ 182 public static ChangePlainEnumValueOrderChangeBuilder builder() { 183 return ChangePlainEnumValueOrderChangeBuilder.of(); 184 } 185 186 /** 187 * create builder for ChangePlainEnumValueOrderChange instance 188 * @param template instance with prefilled values for the builder 189 * @return builder 190 */ 191 public static ChangePlainEnumValueOrderChangeBuilder builder(final ChangePlainEnumValueOrderChange template) { 192 return ChangePlainEnumValueOrderChangeBuilder.of(template); 193 } 194 195 /** 196 * accessor map function 197 * @param <T> mapped type 198 * @param helper function to map the object 199 * @return mapped value 200 */ 201 default <T> T withChangePlainEnumValueOrderChange(Function<ChangePlainEnumValueOrderChange, T> helper) { 202 return helper.apply(this); 203 } 204 205 /** 206 * gives a TypeReference for usage with Jackson DataBind 207 * @return TypeReference 208 */ 209 public static com.fasterxml.jackson.core.type.TypeReference<ChangePlainEnumValueOrderChange> typeReference() { 210 return new com.fasterxml.jackson.core.type.TypeReference<ChangePlainEnumValueOrderChange>() { 211 @Override 212 public String toString() { 213 return "TypeReference<ChangePlainEnumValueOrderChange>"; 214 } 215 }; 216 } 217}