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