001
002package com.commercetools.history.models.change;
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 * AddPaymentChangeBuilder
012 * <hr>
013 * Example to create an instance using the builder pattern
014 * <div class=code-example>
015 * <pre><code class='java'>
016 *     AddPaymentChange addPaymentChange = AddPaymentChange.builder()
017 *             .change("{change}")
018 *             .previousValue(previousValueBuilder -> previousValueBuilder)
019 *             .nextValue(nextValueBuilder -> nextValueBuilder)
020 *             .build()
021 * </code></pre>
022 * </div>
023 */
024@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
025public class AddPaymentChangeBuilder implements Builder<AddPaymentChange> {
026
027    private String change;
028
029    private com.commercetools.history.models.common.PaymentInfo previousValue;
030
031    private com.commercetools.history.models.common.PaymentInfo nextValue;
032
033    /**
034     * set the value to the change
035     * @param change value to be set
036     * @return Builder
037     */
038
039    public AddPaymentChangeBuilder change(final String change) {
040        this.change = change;
041        return this;
042    }
043
044    /**
045     *  <p>Value before the change.</p>
046     * @param builder function to build the previousValue value
047     * @return Builder
048     */
049
050    public AddPaymentChangeBuilder previousValue(
051            Function<com.commercetools.history.models.common.PaymentInfoBuilder, com.commercetools.history.models.common.PaymentInfoBuilder> builder) {
052        this.previousValue = builder.apply(com.commercetools.history.models.common.PaymentInfoBuilder.of()).build();
053        return this;
054    }
055
056    /**
057     *  <p>Value before the change.</p>
058     * @param builder function to build the previousValue value
059     * @return Builder
060     */
061
062    public AddPaymentChangeBuilder withPreviousValue(
063            Function<com.commercetools.history.models.common.PaymentInfoBuilder, com.commercetools.history.models.common.PaymentInfo> builder) {
064        this.previousValue = builder.apply(com.commercetools.history.models.common.PaymentInfoBuilder.of());
065        return this;
066    }
067
068    /**
069     *  <p>Value before the change.</p>
070     * @param previousValue value to be set
071     * @return Builder
072     */
073
074    public AddPaymentChangeBuilder previousValue(
075            final com.commercetools.history.models.common.PaymentInfo previousValue) {
076        this.previousValue = previousValue;
077        return this;
078    }
079
080    /**
081     *  <p>Value after the change.</p>
082     * @param builder function to build the nextValue value
083     * @return Builder
084     */
085
086    public AddPaymentChangeBuilder nextValue(
087            Function<com.commercetools.history.models.common.PaymentInfoBuilder, com.commercetools.history.models.common.PaymentInfoBuilder> builder) {
088        this.nextValue = builder.apply(com.commercetools.history.models.common.PaymentInfoBuilder.of()).build();
089        return this;
090    }
091
092    /**
093     *  <p>Value after the change.</p>
094     * @param builder function to build the nextValue value
095     * @return Builder
096     */
097
098    public AddPaymentChangeBuilder withNextValue(
099            Function<com.commercetools.history.models.common.PaymentInfoBuilder, com.commercetools.history.models.common.PaymentInfo> builder) {
100        this.nextValue = builder.apply(com.commercetools.history.models.common.PaymentInfoBuilder.of());
101        return this;
102    }
103
104    /**
105     *  <p>Value after the change.</p>
106     * @param nextValue value to be set
107     * @return Builder
108     */
109
110    public AddPaymentChangeBuilder nextValue(final com.commercetools.history.models.common.PaymentInfo nextValue) {
111        this.nextValue = nextValue;
112        return this;
113    }
114
115    /**
116     * value of change}
117     * @return change
118     */
119
120    public String getChange() {
121        return this.change;
122    }
123
124    /**
125     *  <p>Value before the change.</p>
126     * @return previousValue
127     */
128
129    public com.commercetools.history.models.common.PaymentInfo getPreviousValue() {
130        return this.previousValue;
131    }
132
133    /**
134     *  <p>Value after the change.</p>
135     * @return nextValue
136     */
137
138    public com.commercetools.history.models.common.PaymentInfo getNextValue() {
139        return this.nextValue;
140    }
141
142    /**
143     * builds AddPaymentChange with checking for non-null required values
144     * @return AddPaymentChange
145     */
146    public AddPaymentChange build() {
147        Objects.requireNonNull(change, AddPaymentChange.class + ": change is missing");
148        Objects.requireNonNull(previousValue, AddPaymentChange.class + ": previousValue is missing");
149        Objects.requireNonNull(nextValue, AddPaymentChange.class + ": nextValue is missing");
150        return new AddPaymentChangeImpl(change, previousValue, nextValue);
151    }
152
153    /**
154     * builds AddPaymentChange without checking for non-null required values
155     * @return AddPaymentChange
156     */
157    public AddPaymentChange buildUnchecked() {
158        return new AddPaymentChangeImpl(change, previousValue, nextValue);
159    }
160
161    /**
162     * factory method for an instance of AddPaymentChangeBuilder
163     * @return builder
164     */
165    public static AddPaymentChangeBuilder of() {
166        return new AddPaymentChangeBuilder();
167    }
168
169    /**
170     * create builder for AddPaymentChange instance
171     * @param template instance with prefilled values for the builder
172     * @return builder
173     */
174    public static AddPaymentChangeBuilder of(final AddPaymentChange template) {
175        AddPaymentChangeBuilder builder = new AddPaymentChangeBuilder();
176        builder.change = template.getChange();
177        builder.previousValue = template.getPreviousValue();
178        builder.nextValue = template.getNextValue();
179        return builder;
180    }
181
182}