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.ShoppingListLineItemValue;
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 ShoppingListLineItem 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 *     ChangeShoppingListLineItemQuantityChange changeShoppingListLineItemQuantityChange = ChangeShoppingListLineItemQuantityChange.builder()
026 *             .change("{change}")
027 *             .previousValue(1)
028 *             .nextValue(1)
029 *             .lineItem(lineItemBuilder -> lineItemBuilder)
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 = ChangeShoppingListLineItemQuantityChangeImpl.class)
036public interface ChangeShoppingListLineItemQuantityChange extends Change {
037
038    /**
039     * discriminator value for ChangeShoppingListLineItemQuantityChange
040     */
041    String CHANGE_SHOPPING_LIST_LINE_ITEM_QUANTITY_CHANGE = "ChangeShoppingListLineItemQuantityChange";
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 Shopping List Line Item.</p>
077     * @return lineItem
078     */
079    @NotNull
080    @Valid
081    @JsonProperty("lineItem")
082    public ShoppingListLineItemValue getLineItem();
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 Shopping List Line Item.</p>
107     * @param lineItem value to be set
108     */
109
110    public void setLineItem(final ShoppingListLineItemValue lineItem);
111
112    /**
113     * factory method
114     * @return instance of ChangeShoppingListLineItemQuantityChange
115     */
116    public static ChangeShoppingListLineItemQuantityChange of() {
117        return new ChangeShoppingListLineItemQuantityChangeImpl();
118    }
119
120    /**
121     * factory method to create a shallow copy ChangeShoppingListLineItemQuantityChange
122     * @param template instance to be copied
123     * @return copy instance
124     */
125    public static ChangeShoppingListLineItemQuantityChange of(final ChangeShoppingListLineItemQuantityChange template) {
126        ChangeShoppingListLineItemQuantityChangeImpl instance = new ChangeShoppingListLineItemQuantityChangeImpl();
127        instance.setChange(template.getChange());
128        instance.setPreviousValue(template.getPreviousValue());
129        instance.setNextValue(template.getNextValue());
130        instance.setLineItem(template.getLineItem());
131        return instance;
132    }
133
134    /**
135     * factory method to create a deep copy of ChangeShoppingListLineItemQuantityChange
136     * @param template instance to be copied
137     * @return copy instance
138     */
139    @Nullable
140    public static ChangeShoppingListLineItemQuantityChange deepCopy(
141            @Nullable final ChangeShoppingListLineItemQuantityChange template) {
142        if (template == null) {
143            return null;
144        }
145        ChangeShoppingListLineItemQuantityChangeImpl instance = new ChangeShoppingListLineItemQuantityChangeImpl();
146        instance.setChange(template.getChange());
147        instance.setPreviousValue(template.getPreviousValue());
148        instance.setNextValue(template.getNextValue());
149        instance.setLineItem(
150            com.commercetools.history.models.change_value.ShoppingListLineItemValue.deepCopy(template.getLineItem()));
151        return instance;
152    }
153
154    /**
155     * builder factory method for ChangeShoppingListLineItemQuantityChange
156     * @return builder
157     */
158    public static ChangeShoppingListLineItemQuantityChangeBuilder builder() {
159        return ChangeShoppingListLineItemQuantityChangeBuilder.of();
160    }
161
162    /**
163     * create builder for ChangeShoppingListLineItemQuantityChange instance
164     * @param template instance with prefilled values for the builder
165     * @return builder
166     */
167    public static ChangeShoppingListLineItemQuantityChangeBuilder builder(
168            final ChangeShoppingListLineItemQuantityChange template) {
169        return ChangeShoppingListLineItemQuantityChangeBuilder.of(template);
170    }
171
172    /**
173     * accessor map function
174     * @param <T> mapped type
175     * @param helper function to map the object
176     * @return mapped value
177     */
178    default <T> T withChangeShoppingListLineItemQuantityChange(
179            Function<ChangeShoppingListLineItemQuantityChange, T> helper) {
180        return helper.apply(this);
181    }
182
183    /**
184     * gives a TypeReference for usage with Jackson DataBind
185     * @return TypeReference
186     */
187    public static com.fasterxml.jackson.core.type.TypeReference<ChangeShoppingListLineItemQuantityChange> typeReference() {
188        return new com.fasterxml.jackson.core.type.TypeReference<ChangeShoppingListLineItemQuantityChange>() {
189            @Override
190            public String toString() {
191                return "TypeReference<ChangeShoppingListLineItemQuantityChange>";
192            }
193        };
194    }
195}