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