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.ShoppingListLineItemValue;
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 ShoppingListLineItems Order 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 *     ChangeShoppingListLineItemsOrderChange changeShoppingListLineItemsOrderChange = ChangeShoppingListLineItemsOrderChange.builder()
027 *             .change("{change}")
028 *             .plusPreviousValue(previousValueBuilder -> previousValueBuilder)
029 *             .plusNextValue(nextValueBuilder -> nextValueBuilder)
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 = ChangeShoppingListLineItemsOrderChangeImpl.class)
036public interface ChangeShoppingListLineItemsOrderChange extends Change {
037
038    /**
039     * discriminator value for ChangeShoppingListLineItemsOrderChange
040     */
041    String CHANGE_SHOPPING_LIST_LINE_ITEMS_ORDER_CHANGE = "ChangeShoppingListLineItemsOrderChange";
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    @Valid
065    @JsonProperty("previousValue")
066    public List<ShoppingListLineItemValue> getPreviousValue();
067
068    /**
069     *  <p>Value after the change.</p>
070     * @return nextValue
071     */
072    @NotNull
073    @Valid
074    @JsonProperty("nextValue")
075    public List<ShoppingListLineItemValue> getNextValue();
076
077    /**
078     * set change
079     * @param change value to be set
080     */
081
082    public void setChange(final String change);
083
084    /**
085     *  <p>Value before the change.</p>
086     * @param previousValue values to be set
087     */
088
089    @JsonIgnore
090    public void setPreviousValue(final ShoppingListLineItemValue... previousValue);
091
092    /**
093     *  <p>Value before the change.</p>
094     * @param previousValue values to be set
095     */
096
097    public void setPreviousValue(final List<ShoppingListLineItemValue> previousValue);
098
099    /**
100     *  <p>Value after the change.</p>
101     * @param nextValue values to be set
102     */
103
104    @JsonIgnore
105    public void setNextValue(final ShoppingListLineItemValue... nextValue);
106
107    /**
108     *  <p>Value after the change.</p>
109     * @param nextValue values to be set
110     */
111
112    public void setNextValue(final List<ShoppingListLineItemValue> nextValue);
113
114    /**
115     * factory method
116     * @return instance of ChangeShoppingListLineItemsOrderChange
117     */
118    public static ChangeShoppingListLineItemsOrderChange of() {
119        return new ChangeShoppingListLineItemsOrderChangeImpl();
120    }
121
122    /**
123     * factory method to create a shallow copy ChangeShoppingListLineItemsOrderChange
124     * @param template instance to be copied
125     * @return copy instance
126     */
127    public static ChangeShoppingListLineItemsOrderChange of(final ChangeShoppingListLineItemsOrderChange template) {
128        ChangeShoppingListLineItemsOrderChangeImpl instance = new ChangeShoppingListLineItemsOrderChangeImpl();
129        instance.setChange(template.getChange());
130        instance.setPreviousValue(template.getPreviousValue());
131        instance.setNextValue(template.getNextValue());
132        return instance;
133    }
134
135    /**
136     * factory method to create a deep copy of ChangeShoppingListLineItemsOrderChange
137     * @param template instance to be copied
138     * @return copy instance
139     */
140    @Nullable
141    public static ChangeShoppingListLineItemsOrderChange deepCopy(
142            @Nullable final ChangeShoppingListLineItemsOrderChange template) {
143        if (template == null) {
144            return null;
145        }
146        ChangeShoppingListLineItemsOrderChangeImpl instance = new ChangeShoppingListLineItemsOrderChangeImpl();
147        instance.setChange(template.getChange());
148        instance.setPreviousValue(Optional.ofNullable(template.getPreviousValue())
149                .map(t -> t.stream()
150                        .map(com.commercetools.history.models.change_value.ShoppingListLineItemValue::deepCopy)
151                        .collect(Collectors.toList()))
152                .orElse(null));
153        instance.setNextValue(Optional.ofNullable(template.getNextValue())
154                .map(t -> t.stream()
155                        .map(com.commercetools.history.models.change_value.ShoppingListLineItemValue::deepCopy)
156                        .collect(Collectors.toList()))
157                .orElse(null));
158        return instance;
159    }
160
161    /**
162     * builder factory method for ChangeShoppingListLineItemsOrderChange
163     * @return builder
164     */
165    public static ChangeShoppingListLineItemsOrderChangeBuilder builder() {
166        return ChangeShoppingListLineItemsOrderChangeBuilder.of();
167    }
168
169    /**
170     * create builder for ChangeShoppingListLineItemsOrderChange instance
171     * @param template instance with prefilled values for the builder
172     * @return builder
173     */
174    public static ChangeShoppingListLineItemsOrderChangeBuilder builder(
175            final ChangeShoppingListLineItemsOrderChange template) {
176        return ChangeShoppingListLineItemsOrderChangeBuilder.of(template);
177    }
178
179    /**
180     * accessor map function
181     * @param <T> mapped type
182     * @param helper function to map the object
183     * @return mapped value
184     */
185    default <T> T withChangeShoppingListLineItemsOrderChange(
186            Function<ChangeShoppingListLineItemsOrderChange, T> helper) {
187        return helper.apply(this);
188    }
189
190    /**
191     * gives a TypeReference for usage with Jackson DataBind
192     * @return TypeReference
193     */
194    public static com.fasterxml.jackson.core.type.TypeReference<ChangeShoppingListLineItemsOrderChange> typeReference() {
195        return new com.fasterxml.jackson.core.type.TypeReference<ChangeShoppingListLineItemsOrderChange>() {
196            @Override
197            public String toString() {
198                return "TypeReference<ChangeShoppingListLineItemsOrderChange>";
199            }
200        };
201    }
202}