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.EnumValue;
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 Add EnumValue to FieldDefinition update action.</p>
020 *
021 * <hr>
022 * Example to create an instance using the builder pattern
023 * <div class=code-example>
024 * <pre><code class='java'>
025 *     AddEnumValueChange addEnumValueChange = AddEnumValueChange.builder()
026 *             .change("{change}")
027 *             .nextValue(nextValueBuilder -> nextValueBuilder)
028 *             .fieldName("{fieldName}")
029 *             .build()
030 * </code></pre>
031 * </div>
032 */
033@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
034@JsonDeserialize(as = AddEnumValueChangeImpl.class)
035public interface AddEnumValueChange extends Change {
036
037    /**
038     * discriminator value for AddEnumValueChange
039     */
040    String ADD_ENUM_VALUE_CHANGE = "AddEnumValueChange";
041
042    /**
043     *
044     * @return type
045     */
046    @NotNull
047    @JsonProperty("type")
048    public String getType();
049
050    /**
051     *
052     * @return change
053     */
054    @NotNull
055    @JsonProperty("change")
056    public String getChange();
057
058    /**
059     *  <p>Value after the change.</p>
060     * @return nextValue
061     */
062    @NotNull
063    @Valid
064    @JsonProperty("nextValue")
065    public EnumValue getNextValue();
066
067    /**
068     *  <p>Name of the updated FieldDefinition.</p>
069     * @return fieldName
070     */
071    @NotNull
072    @JsonProperty("fieldName")
073    public String getFieldName();
074
075    /**
076     * set change
077     * @param change value to be set
078     */
079
080    public void setChange(final String change);
081
082    /**
083     *  <p>Value after the change.</p>
084     * @param nextValue value to be set
085     */
086
087    public void setNextValue(final EnumValue nextValue);
088
089    /**
090     *  <p>Name of the updated FieldDefinition.</p>
091     * @param fieldName value to be set
092     */
093
094    public void setFieldName(final String fieldName);
095
096    /**
097     * factory method
098     * @return instance of AddEnumValueChange
099     */
100    public static AddEnumValueChange of() {
101        return new AddEnumValueChangeImpl();
102    }
103
104    /**
105     * factory method to create a shallow copy AddEnumValueChange
106     * @param template instance to be copied
107     * @return copy instance
108     */
109    public static AddEnumValueChange of(final AddEnumValueChange template) {
110        AddEnumValueChangeImpl instance = new AddEnumValueChangeImpl();
111        instance.setChange(template.getChange());
112        instance.setNextValue(template.getNextValue());
113        instance.setFieldName(template.getFieldName());
114        return instance;
115    }
116
117    /**
118     * factory method to create a deep copy of AddEnumValueChange
119     * @param template instance to be copied
120     * @return copy instance
121     */
122    @Nullable
123    public static AddEnumValueChange deepCopy(@Nullable final AddEnumValueChange template) {
124        if (template == null) {
125            return null;
126        }
127        AddEnumValueChangeImpl instance = new AddEnumValueChangeImpl();
128        instance.setChange(template.getChange());
129        instance.setNextValue(
130            com.commercetools.history.models.change_value.EnumValue.deepCopy(template.getNextValue()));
131        instance.setFieldName(template.getFieldName());
132        return instance;
133    }
134
135    /**
136     * builder factory method for AddEnumValueChange
137     * @return builder
138     */
139    public static AddEnumValueChangeBuilder builder() {
140        return AddEnumValueChangeBuilder.of();
141    }
142
143    /**
144     * create builder for AddEnumValueChange instance
145     * @param template instance with prefilled values for the builder
146     * @return builder
147     */
148    public static AddEnumValueChangeBuilder builder(final AddEnumValueChange template) {
149        return AddEnumValueChangeBuilder.of(template);
150    }
151
152    /**
153     * accessor map function
154     * @param <T> mapped type
155     * @param helper function to map the object
156     * @return mapped value
157     */
158    default <T> T withAddEnumValueChange(Function<AddEnumValueChange, T> helper) {
159        return helper.apply(this);
160    }
161
162    /**
163     * gives a TypeReference for usage with Jackson DataBind
164     * @return TypeReference
165     */
166    public static com.fasterxml.jackson.core.type.TypeReference<AddEnumValueChange> typeReference() {
167        return new com.fasterxml.jackson.core.type.TypeReference<AddEnumValueChange>() {
168            @Override
169            public String toString() {
170                return "TypeReference<AddEnumValueChange>";
171            }
172        };
173    }
174}