001
002package com.commercetools.history.models.change_value;
003
004import java.util.*;
005import java.util.function.Function;
006
007import io.vrap.rmf.base.client.Builder;
008import io.vrap.rmf.base.client.utils.Generated;
009
010/**
011 * ChangeValueAbsoluteChangeValueBuilder
012 * <hr>
013 * Example to create an instance using the builder pattern
014 * <div class=code-example>
015 * <pre><code class='java'>
016 *     ChangeValueAbsoluteChangeValue changeValueAbsoluteChangeValue = ChangeValueAbsoluteChangeValue.builder()
017 *             .plusMoney(moneyBuilder -> moneyBuilder)
018 *             .build()
019 * </code></pre>
020 * </div>
021 */
022@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
023public class ChangeValueAbsoluteChangeValueBuilder implements Builder<ChangeValueAbsoluteChangeValue> {
024
025    private java.util.List<com.commercetools.history.models.common.Money> money;
026
027    /**
028     *  <p>Money values in different currencies.</p>
029     * @param money value to be set
030     * @return Builder
031     */
032
033    public ChangeValueAbsoluteChangeValueBuilder money(final com.commercetools.history.models.common.Money... money) {
034        this.money = new ArrayList<>(Arrays.asList(money));
035        return this;
036    }
037
038    /**
039     *  <p>Money values in different currencies.</p>
040     * @param money value to be set
041     * @return Builder
042     */
043
044    public ChangeValueAbsoluteChangeValueBuilder money(
045            final java.util.List<com.commercetools.history.models.common.Money> money) {
046        this.money = money;
047        return this;
048    }
049
050    /**
051     *  <p>Money values in different currencies.</p>
052     * @param money value to be set
053     * @return Builder
054     */
055
056    public ChangeValueAbsoluteChangeValueBuilder plusMoney(
057            final com.commercetools.history.models.common.Money... money) {
058        if (this.money == null) {
059            this.money = new ArrayList<>();
060        }
061        this.money.addAll(Arrays.asList(money));
062        return this;
063    }
064
065    /**
066     *  <p>Money values in different currencies.</p>
067     * @param builder function to build the money value
068     * @return Builder
069     */
070
071    public ChangeValueAbsoluteChangeValueBuilder plusMoney(
072            Function<com.commercetools.history.models.common.MoneyBuilder, com.commercetools.history.models.common.MoneyBuilder> builder) {
073        if (this.money == null) {
074            this.money = new ArrayList<>();
075        }
076        this.money.add(builder.apply(com.commercetools.history.models.common.MoneyBuilder.of()).build());
077        return this;
078    }
079
080    /**
081     *  <p>Money values in different currencies.</p>
082     * @param builder function to build the money value
083     * @return Builder
084     */
085
086    public ChangeValueAbsoluteChangeValueBuilder withMoney(
087            Function<com.commercetools.history.models.common.MoneyBuilder, com.commercetools.history.models.common.MoneyBuilder> builder) {
088        this.money = new ArrayList<>();
089        this.money.add(builder.apply(com.commercetools.history.models.common.MoneyBuilder.of()).build());
090        return this;
091    }
092
093    /**
094     *  <p>Money values in different currencies.</p>
095     * @param builder function to build the money value
096     * @return Builder
097     */
098
099    public ChangeValueAbsoluteChangeValueBuilder addMoney(
100            Function<com.commercetools.history.models.common.MoneyBuilder, com.commercetools.history.models.common.Money> builder) {
101        return plusMoney(builder.apply(com.commercetools.history.models.common.MoneyBuilder.of()));
102    }
103
104    /**
105     *  <p>Money values in different currencies.</p>
106     * @param builder function to build the money value
107     * @return Builder
108     */
109
110    public ChangeValueAbsoluteChangeValueBuilder setMoney(
111            Function<com.commercetools.history.models.common.MoneyBuilder, com.commercetools.history.models.common.Money> builder) {
112        return money(builder.apply(com.commercetools.history.models.common.MoneyBuilder.of()));
113    }
114
115    /**
116     *  <p>Money values in different currencies.</p>
117     * @return money
118     */
119
120    public java.util.List<com.commercetools.history.models.common.Money> getMoney() {
121        return this.money;
122    }
123
124    /**
125     * builds ChangeValueAbsoluteChangeValue with checking for non-null required values
126     * @return ChangeValueAbsoluteChangeValue
127     */
128    public ChangeValueAbsoluteChangeValue build() {
129        Objects.requireNonNull(money, ChangeValueAbsoluteChangeValue.class + ": money is missing");
130        return new ChangeValueAbsoluteChangeValueImpl(money);
131    }
132
133    /**
134     * builds ChangeValueAbsoluteChangeValue without checking for non-null required values
135     * @return ChangeValueAbsoluteChangeValue
136     */
137    public ChangeValueAbsoluteChangeValue buildUnchecked() {
138        return new ChangeValueAbsoluteChangeValueImpl(money);
139    }
140
141    /**
142     * factory method for an instance of ChangeValueAbsoluteChangeValueBuilder
143     * @return builder
144     */
145    public static ChangeValueAbsoluteChangeValueBuilder of() {
146        return new ChangeValueAbsoluteChangeValueBuilder();
147    }
148
149    /**
150     * create builder for ChangeValueAbsoluteChangeValue instance
151     * @param template instance with prefilled values for the builder
152     * @return builder
153     */
154    public static ChangeValueAbsoluteChangeValueBuilder of(final ChangeValueAbsoluteChangeValue template) {
155        ChangeValueAbsoluteChangeValueBuilder builder = new ChangeValueAbsoluteChangeValueBuilder();
156        builder.money = template.getMoney();
157        return builder;
158    }
159
160}