001
002package com.commercetools.history.models.change_value;
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.common.Money;
014import com.fasterxml.jackson.annotation.*;
015import com.fasterxml.jackson.databind.annotation.*;
016
017import io.vrap.rmf.base.client.utils.Generated;
018
019/**
020 * ChangeValueAbsoluteChangeValue
021 *
022 * <hr>
023 * Example to create an instance using the builder pattern
024 * <div class=code-example>
025 * <pre><code class='java'>
026 *     ChangeValueAbsoluteChangeValue changeValueAbsoluteChangeValue = ChangeValueAbsoluteChangeValue.builder()
027 *             .plusMoney(moneyBuilder -> moneyBuilder)
028 *             .build()
029 * </code></pre>
030 * </div>
031 */
032@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
033@JsonDeserialize(as = ChangeValueAbsoluteChangeValueImpl.class)
034public interface ChangeValueAbsoluteChangeValue extends ChangeValueChangeValue {
035
036    /**
037     * discriminator value for ChangeValueAbsoluteChangeValue
038     */
039    String ABSOLUTE = "absolute";
040
041    /**
042     *
043     * @return type
044     */
045    @NotNull
046    @JsonProperty("type")
047    public String getType();
048
049    /**
050     *  <p>Money values in different currencies.</p>
051     * @return money
052     */
053    @NotNull
054    @Valid
055    @JsonProperty("money")
056    public List<Money> getMoney();
057
058    /**
059     *  <p>Money values in different currencies.</p>
060     * @param money values to be set
061     */
062
063    @JsonIgnore
064    public void setMoney(final Money... money);
065
066    /**
067     *  <p>Money values in different currencies.</p>
068     * @param money values to be set
069     */
070
071    public void setMoney(final List<Money> money);
072
073    /**
074     * factory method
075     * @return instance of ChangeValueAbsoluteChangeValue
076     */
077    public static ChangeValueAbsoluteChangeValue of() {
078        return new ChangeValueAbsoluteChangeValueImpl();
079    }
080
081    /**
082     * factory method to create a shallow copy ChangeValueAbsoluteChangeValue
083     * @param template instance to be copied
084     * @return copy instance
085     */
086    public static ChangeValueAbsoluteChangeValue of(final ChangeValueAbsoluteChangeValue template) {
087        ChangeValueAbsoluteChangeValueImpl instance = new ChangeValueAbsoluteChangeValueImpl();
088        instance.setMoney(template.getMoney());
089        return instance;
090    }
091
092    /**
093     * factory method to create a deep copy of ChangeValueAbsoluteChangeValue
094     * @param template instance to be copied
095     * @return copy instance
096     */
097    @Nullable
098    public static ChangeValueAbsoluteChangeValue deepCopy(@Nullable final ChangeValueAbsoluteChangeValue template) {
099        if (template == null) {
100            return null;
101        }
102        ChangeValueAbsoluteChangeValueImpl instance = new ChangeValueAbsoluteChangeValueImpl();
103        instance.setMoney(Optional.ofNullable(template.getMoney())
104                .map(t -> t.stream()
105                        .map(com.commercetools.history.models.common.Money::deepCopy)
106                        .collect(Collectors.toList()))
107                .orElse(null));
108        return instance;
109    }
110
111    /**
112     * builder factory method for ChangeValueAbsoluteChangeValue
113     * @return builder
114     */
115    public static ChangeValueAbsoluteChangeValueBuilder builder() {
116        return ChangeValueAbsoluteChangeValueBuilder.of();
117    }
118
119    /**
120     * create builder for ChangeValueAbsoluteChangeValue instance
121     * @param template instance with prefilled values for the builder
122     * @return builder
123     */
124    public static ChangeValueAbsoluteChangeValueBuilder builder(final ChangeValueAbsoluteChangeValue template) {
125        return ChangeValueAbsoluteChangeValueBuilder.of(template);
126    }
127
128    /**
129     * accessor map function
130     * @param <T> mapped type
131     * @param helper function to map the object
132     * @return mapped value
133     */
134    default <T> T withChangeValueAbsoluteChangeValue(Function<ChangeValueAbsoluteChangeValue, T> helper) {
135        return helper.apply(this);
136    }
137
138    /**
139     * gives a TypeReference for usage with Jackson DataBind
140     * @return TypeReference
141     */
142    public static com.fasterxml.jackson.core.type.TypeReference<ChangeValueAbsoluteChangeValue> typeReference() {
143        return new com.fasterxml.jackson.core.type.TypeReference<ChangeValueAbsoluteChangeValue>() {
144            @Override
145            public String toString() {
146                return "TypeReference<ChangeValueAbsoluteChangeValue>";
147            }
148        };
149    }
150}