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