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.TextLineItemValue;
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 Change TextLineItem Quantity 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 *     ChangeTextLineItemQuantityChange changeTextLineItemQuantityChange = ChangeTextLineItemQuantityChange.builder()
026 *             .change("{change}")
027 *             .previousValue(1)
028 *             .nextValue(1)
029 *             .textLineItem(textLineItemBuilder -> textLineItemBuilder)
030 *             .build()
031 * </code></pre>
032 * </div>
033 */
034@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
035@JsonDeserialize(as = ChangeTextLineItemQuantityChangeImpl.class)
036public interface ChangeTextLineItemQuantityChange extends Change {
037
038    /**
039     * discriminator value for ChangeTextLineItemQuantityChange
040     */
041    String CHANGE_TEXT_LINE_ITEM_QUANTITY_CHANGE = "ChangeTextLineItemQuantityChange";
042
043    /**
044     *
045     * @return type
046     */
047    @NotNull
048    @JsonProperty("type")
049    public String getType();
050
051    /**
052     *
053     * @return change
054     */
055    @NotNull
056    @JsonProperty("change")
057    public String getChange();
058
059    /**
060     *  <p>Value before the change.</p>
061     * @return previousValue
062     */
063    @NotNull
064    @JsonProperty("previousValue")
065    public Integer getPreviousValue();
066
067    /**
068     *  <p>Value after the change.</p>
069     * @return nextValue
070     */
071    @NotNull
072    @JsonProperty("nextValue")
073    public Integer getNextValue();
074
075    /**
076     *  <p>Holds information about the updated Text Line Item.</p>
077     * @return textLineItem
078     */
079    @NotNull
080    @Valid
081    @JsonProperty("textLineItem")
082    public TextLineItemValue getTextLineItem();
083
084    /**
085     * set change
086     * @param change value to be set
087     */
088
089    public void setChange(final String change);
090
091    /**
092     *  <p>Value before the change.</p>
093     * @param previousValue value to be set
094     */
095
096    public void setPreviousValue(final Integer previousValue);
097
098    /**
099     *  <p>Value after the change.</p>
100     * @param nextValue value to be set
101     */
102
103    public void setNextValue(final Integer nextValue);
104
105    /**
106     *  <p>Holds information about the updated Text Line Item.</p>
107     * @param textLineItem value to be set
108     */
109
110    public void setTextLineItem(final TextLineItemValue textLineItem);
111
112    /**
113     * factory method
114     * @return instance of ChangeTextLineItemQuantityChange
115     */
116    public static ChangeTextLineItemQuantityChange of() {
117        return new ChangeTextLineItemQuantityChangeImpl();
118    }
119
120    /**
121     * factory method to create a shallow copy ChangeTextLineItemQuantityChange
122     * @param template instance to be copied
123     * @return copy instance
124     */
125    public static ChangeTextLineItemQuantityChange of(final ChangeTextLineItemQuantityChange template) {
126        ChangeTextLineItemQuantityChangeImpl instance = new ChangeTextLineItemQuantityChangeImpl();
127        instance.setChange(template.getChange());
128        instance.setPreviousValue(template.getPreviousValue());
129        instance.setNextValue(template.getNextValue());
130        instance.setTextLineItem(template.getTextLineItem());
131        return instance;
132    }
133
134    /**
135     * factory method to create a deep copy of ChangeTextLineItemQuantityChange
136     * @param template instance to be copied
137     * @return copy instance
138     */
139    @Nullable
140    public static ChangeTextLineItemQuantityChange deepCopy(@Nullable final ChangeTextLineItemQuantityChange template) {
141        if (template == null) {
142            return null;
143        }
144        ChangeTextLineItemQuantityChangeImpl instance = new ChangeTextLineItemQuantityChangeImpl();
145        instance.setChange(template.getChange());
146        instance.setPreviousValue(template.getPreviousValue());
147        instance.setNextValue(template.getNextValue());
148        instance.setTextLineItem(
149            com.commercetools.history.models.change_value.TextLineItemValue.deepCopy(template.getTextLineItem()));
150        return instance;
151    }
152
153    /**
154     * builder factory method for ChangeTextLineItemQuantityChange
155     * @return builder
156     */
157    public static ChangeTextLineItemQuantityChangeBuilder builder() {
158        return ChangeTextLineItemQuantityChangeBuilder.of();
159    }
160
161    /**
162     * create builder for ChangeTextLineItemQuantityChange instance
163     * @param template instance with prefilled values for the builder
164     * @return builder
165     */
166    public static ChangeTextLineItemQuantityChangeBuilder builder(final ChangeTextLineItemQuantityChange template) {
167        return ChangeTextLineItemQuantityChangeBuilder.of(template);
168    }
169
170    /**
171     * accessor map function
172     * @param <T> mapped type
173     * @param helper function to map the object
174     * @return mapped value
175     */
176    default <T> T withChangeTextLineItemQuantityChange(Function<ChangeTextLineItemQuantityChange, T> helper) {
177        return helper.apply(this);
178    }
179
180    /**
181     * gives a TypeReference for usage with Jackson DataBind
182     * @return TypeReference
183     */
184    public static com.fasterxml.jackson.core.type.TypeReference<ChangeTextLineItemQuantityChange> typeReference() {
185        return new com.fasterxml.jackson.core.type.TypeReference<ChangeTextLineItemQuantityChange>() {
186            @Override
187            public String toString() {
188                return "TypeReference<ChangeTextLineItemQuantityChange>";
189            }
190        };
191    }
192}