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 * AddAssetChangeBuilder
012 * <hr>
013 * Example to create an instance using the builder pattern
014 * <div class=code-example>
015 * <pre><code class='java'>
016 *     AddAssetChange addAssetChange = AddAssetChange.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 AddAssetChangeBuilder implements Builder<AddAssetChange> {
026
027    private String change;
028
029    private com.commercetools.history.models.common.Asset previousValue;
030
031    private com.commercetools.history.models.common.Asset nextValue;
032
033    /**
034     * set the value to the change
035     * @param change value to be set
036     * @return Builder
037     */
038
039    public AddAssetChangeBuilder 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 AddAssetChangeBuilder previousValue(
051            Function<com.commercetools.history.models.common.AssetBuilder, com.commercetools.history.models.common.AssetBuilder> builder) {
052        this.previousValue = builder.apply(com.commercetools.history.models.common.AssetBuilder.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 AddAssetChangeBuilder withPreviousValue(
063            Function<com.commercetools.history.models.common.AssetBuilder, com.commercetools.history.models.common.Asset> builder) {
064        this.previousValue = builder.apply(com.commercetools.history.models.common.AssetBuilder.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 AddAssetChangeBuilder previousValue(final com.commercetools.history.models.common.Asset previousValue) {
075        this.previousValue = previousValue;
076        return this;
077    }
078
079    /**
080     *  <p>Value after the change.</p>
081     * @param builder function to build the nextValue value
082     * @return Builder
083     */
084
085    public AddAssetChangeBuilder nextValue(
086            Function<com.commercetools.history.models.common.AssetBuilder, com.commercetools.history.models.common.AssetBuilder> builder) {
087        this.nextValue = builder.apply(com.commercetools.history.models.common.AssetBuilder.of()).build();
088        return this;
089    }
090
091    /**
092     *  <p>Value after the change.</p>
093     * @param builder function to build the nextValue value
094     * @return Builder
095     */
096
097    public AddAssetChangeBuilder withNextValue(
098            Function<com.commercetools.history.models.common.AssetBuilder, com.commercetools.history.models.common.Asset> builder) {
099        this.nextValue = builder.apply(com.commercetools.history.models.common.AssetBuilder.of());
100        return this;
101    }
102
103    /**
104     *  <p>Value after the change.</p>
105     * @param nextValue value to be set
106     * @return Builder
107     */
108
109    public AddAssetChangeBuilder nextValue(final com.commercetools.history.models.common.Asset nextValue) {
110        this.nextValue = nextValue;
111        return this;
112    }
113
114    /**
115     * value of change}
116     * @return change
117     */
118
119    public String getChange() {
120        return this.change;
121    }
122
123    /**
124     *  <p>Value before the change.</p>
125     * @return previousValue
126     */
127
128    public com.commercetools.history.models.common.Asset getPreviousValue() {
129        return this.previousValue;
130    }
131
132    /**
133     *  <p>Value after the change.</p>
134     * @return nextValue
135     */
136
137    public com.commercetools.history.models.common.Asset getNextValue() {
138        return this.nextValue;
139    }
140
141    /**
142     * builds AddAssetChange with checking for non-null required values
143     * @return AddAssetChange
144     */
145    public AddAssetChange build() {
146        Objects.requireNonNull(change, AddAssetChange.class + ": change is missing");
147        Objects.requireNonNull(previousValue, AddAssetChange.class + ": previousValue is missing");
148        Objects.requireNonNull(nextValue, AddAssetChange.class + ": nextValue is missing");
149        return new AddAssetChangeImpl(change, previousValue, nextValue);
150    }
151
152    /**
153     * builds AddAssetChange without checking for non-null required values
154     * @return AddAssetChange
155     */
156    public AddAssetChange buildUnchecked() {
157        return new AddAssetChangeImpl(change, previousValue, nextValue);
158    }
159
160    /**
161     * factory method for an instance of AddAssetChangeBuilder
162     * @return builder
163     */
164    public static AddAssetChangeBuilder of() {
165        return new AddAssetChangeBuilder();
166    }
167
168    /**
169     * create builder for AddAssetChange instance
170     * @param template instance with prefilled values for the builder
171     * @return builder
172     */
173    public static AddAssetChangeBuilder of(final AddAssetChange template) {
174        AddAssetChangeBuilder builder = new AddAssetChangeBuilder();
175        builder.change = template.getChange();
176        builder.previousValue = template.getPreviousValue();
177        builder.nextValue = template.getNextValue();
178        return builder;
179    }
180
181}