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 * AddAttributeDefinitionChangeBuilder
012 * <hr>
013 * Example to create an instance using the builder pattern
014 * <div class=code-example>
015 * <pre><code class='java'>
016 *     AddAttributeDefinitionChange addAttributeDefinitionChange = AddAttributeDefinitionChange.builder()
017 *             .change("{change}")
018 *             .nextValue(nextValueBuilder -> nextValueBuilder)
019 *             .build()
020 * </code></pre>
021 * </div>
022 */
023@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
024public class AddAttributeDefinitionChangeBuilder implements Builder<AddAttributeDefinitionChange> {
025
026    private String change;
027
028    private com.commercetools.history.models.common.AttributeDefinition nextValue;
029
030    /**
031     * set the value to the change
032     * @param change value to be set
033     * @return Builder
034     */
035
036    public AddAttributeDefinitionChangeBuilder change(final String change) {
037        this.change = change;
038        return this;
039    }
040
041    /**
042     *  <p>Value after the change.</p>
043     * @param builder function to build the nextValue value
044     * @return Builder
045     */
046
047    public AddAttributeDefinitionChangeBuilder nextValue(
048            Function<com.commercetools.history.models.common.AttributeDefinitionBuilder, com.commercetools.history.models.common.AttributeDefinitionBuilder> builder) {
049        this.nextValue = builder.apply(com.commercetools.history.models.common.AttributeDefinitionBuilder.of()).build();
050        return this;
051    }
052
053    /**
054     *  <p>Value after the change.</p>
055     * @param builder function to build the nextValue value
056     * @return Builder
057     */
058
059    public AddAttributeDefinitionChangeBuilder withNextValue(
060            Function<com.commercetools.history.models.common.AttributeDefinitionBuilder, com.commercetools.history.models.common.AttributeDefinition> builder) {
061        this.nextValue = builder.apply(com.commercetools.history.models.common.AttributeDefinitionBuilder.of());
062        return this;
063    }
064
065    /**
066     *  <p>Value after the change.</p>
067     * @param nextValue value to be set
068     * @return Builder
069     */
070
071    public AddAttributeDefinitionChangeBuilder nextValue(
072            final com.commercetools.history.models.common.AttributeDefinition nextValue) {
073        this.nextValue = nextValue;
074        return this;
075    }
076
077    /**
078     * value of change}
079     * @return change
080     */
081
082    public String getChange() {
083        return this.change;
084    }
085
086    /**
087     *  <p>Value after the change.</p>
088     * @return nextValue
089     */
090
091    public com.commercetools.history.models.common.AttributeDefinition getNextValue() {
092        return this.nextValue;
093    }
094
095    /**
096     * builds AddAttributeDefinitionChange with checking for non-null required values
097     * @return AddAttributeDefinitionChange
098     */
099    public AddAttributeDefinitionChange build() {
100        Objects.requireNonNull(change, AddAttributeDefinitionChange.class + ": change is missing");
101        Objects.requireNonNull(nextValue, AddAttributeDefinitionChange.class + ": nextValue is missing");
102        return new AddAttributeDefinitionChangeImpl(change, nextValue);
103    }
104
105    /**
106     * builds AddAttributeDefinitionChange without checking for non-null required values
107     * @return AddAttributeDefinitionChange
108     */
109    public AddAttributeDefinitionChange buildUnchecked() {
110        return new AddAttributeDefinitionChangeImpl(change, nextValue);
111    }
112
113    /**
114     * factory method for an instance of AddAttributeDefinitionChangeBuilder
115     * @return builder
116     */
117    public static AddAttributeDefinitionChangeBuilder of() {
118        return new AddAttributeDefinitionChangeBuilder();
119    }
120
121    /**
122     * create builder for AddAttributeDefinitionChange instance
123     * @param template instance with prefilled values for the builder
124     * @return builder
125     */
126    public static AddAttributeDefinitionChangeBuilder of(final AddAttributeDefinitionChange template) {
127        AddAttributeDefinitionChangeBuilder builder = new AddAttributeDefinitionChangeBuilder();
128        builder.change = template.getChange();
129        builder.nextValue = template.getNextValue();
130        return builder;
131    }
132
133}