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 *     ChangeEnumValueOrderChange changeEnumValueOrderChange = ChangeEnumValueOrderChange.builder()
027 *             .change("{change}")
028 *             .plusPreviousValue(previousValueBuilder -> previousValueBuilder)
029 *             .plusNextValue(nextValueBuilder -> nextValueBuilder)
030 *             .fieldName("{fieldName}")
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 = ChangeEnumValueOrderChangeImpl.class)
037public interface ChangeEnumValueOrderChange extends Change {
038
039    /**
040     * discriminator value for ChangeEnumValueOrderChange
041     */
042    String CHANGE_ENUM_VALUE_ORDER_CHANGE = "ChangeEnumValueOrderChange";
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 FieldDefinition.</p>
080     * @return fieldName
081     */
082    @NotNull
083    @JsonProperty("fieldName")
084    public String getFieldName();
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 FieldDefinition.</p>
125     * @param fieldName value to be set
126     */
127
128    public void setFieldName(final String fieldName);
129
130    /**
131     * factory method
132     * @return instance of ChangeEnumValueOrderChange
133     */
134    public static ChangeEnumValueOrderChange of() {
135        return new ChangeEnumValueOrderChangeImpl();
136    }
137
138    /**
139     * factory method to create a shallow copy ChangeEnumValueOrderChange
140     * @param template instance to be copied
141     * @return copy instance
142     */
143    public static ChangeEnumValueOrderChange of(final ChangeEnumValueOrderChange template) {
144        ChangeEnumValueOrderChangeImpl instance = new ChangeEnumValueOrderChangeImpl();
145        instance.setChange(template.getChange());
146        instance.setPreviousValue(template.getPreviousValue());
147        instance.setNextValue(template.getNextValue());
148        instance.setFieldName(template.getFieldName());
149        return instance;
150    }
151
152    /**
153     * factory method to create a deep copy of ChangeEnumValueOrderChange
154     * @param template instance to be copied
155     * @return copy instance
156     */
157    @Nullable
158    public static ChangeEnumValueOrderChange deepCopy(@Nullable final ChangeEnumValueOrderChange template) {
159        if (template == null) {
160            return null;
161        }
162        ChangeEnumValueOrderChangeImpl instance = new ChangeEnumValueOrderChangeImpl();
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.setFieldName(template.getFieldName());
175        return instance;
176    }
177
178    /**
179     * builder factory method for ChangeEnumValueOrderChange
180     * @return builder
181     */
182    public static ChangeEnumValueOrderChangeBuilder builder() {
183        return ChangeEnumValueOrderChangeBuilder.of();
184    }
185
186    /**
187     * create builder for ChangeEnumValueOrderChange instance
188     * @param template instance with prefilled values for the builder
189     * @return builder
190     */
191    public static ChangeEnumValueOrderChangeBuilder builder(final ChangeEnumValueOrderChange template) {
192        return ChangeEnumValueOrderChangeBuilder.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 withChangeEnumValueOrderChange(Function<ChangeEnumValueOrderChange, 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<ChangeEnumValueOrderChange> typeReference() {
210        return new com.fasterxml.jackson.core.type.TypeReference<ChangeEnumValueOrderChange>() {
211            @Override
212            public String toString() {
213                return "TypeReference<ChangeEnumValueOrderChange>";
214            }
215        };
216    }
217}