001
002package com.commercetools.api.models.message;
003
004import java.util.*;
005import java.util.function.Function;
006
007import javax.annotation.Nullable;
008
009import io.vrap.rmf.base.client.Builder;
010import io.vrap.rmf.base.client.utils.Generated;
011
012/**
013 * StandalonePriceValueChangedMessagePayloadBuilder
014 * <hr>
015 * Example to create an instance using the builder pattern
016 * <div class=code-example>
017 * <pre><code class='java'>
018 *     StandalonePriceValueChangedMessagePayload standalonePriceValueChangedMessagePayload = StandalonePriceValueChangedMessagePayload.builder()
019 *             .value(valueBuilder -> valueBuilder)
020 *             .staged(true)
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 StandalonePriceValueChangedMessagePayloadBuilder
027        implements Builder<StandalonePriceValueChangedMessagePayload> {
028
029    private com.commercetools.api.models.common.Money value;
030
031    private Boolean staged;
032
033    @Nullable
034    private com.commercetools.api.models.common.Money oldValue;
035
036    /**
037     *  <p>The new value of the updated StandalonePrice.</p>
038     * @param builder function to build the value value
039     * @return Builder
040     */
041
042    public StandalonePriceValueChangedMessagePayloadBuilder value(
043            Function<com.commercetools.api.models.common.MoneyBuilder, com.commercetools.api.models.common.MoneyBuilder> builder) {
044        this.value = builder.apply(com.commercetools.api.models.common.MoneyBuilder.of()).build();
045        return this;
046    }
047
048    /**
049     *  <p>The new value of the updated StandalonePrice.</p>
050     * @param builder function to build the value value
051     * @return Builder
052     */
053
054    public StandalonePriceValueChangedMessagePayloadBuilder withValue(
055            Function<com.commercetools.api.models.common.MoneyBuilder, com.commercetools.api.models.common.Money> builder) {
056        this.value = builder.apply(com.commercetools.api.models.common.MoneyBuilder.of());
057        return this;
058    }
059
060    /**
061     *  <p>The new value of the updated StandalonePrice.</p>
062     * @param value value to be set
063     * @return Builder
064     */
065
066    public StandalonePriceValueChangedMessagePayloadBuilder value(
067            final com.commercetools.api.models.common.Money value) {
068        this.value = value;
069        return this;
070    }
071
072    /**
073     *  <p>Whether the new value was applied to the current or the staged representation of the StandalonePrice. Staged changes are stored on the StagedStandalonePrice.</p>
074     * @param staged value to be set
075     * @return Builder
076     */
077
078    public StandalonePriceValueChangedMessagePayloadBuilder staged(final Boolean staged) {
079        this.staged = staged;
080        return this;
081    }
082
083    /**
084     *  <p>The old value of the updated StandalonePrice. Present on Messages created after 3 February 2023. Optional for backwards compatibility.</p>
085     * @param builder function to build the oldValue value
086     * @return Builder
087     */
088
089    public StandalonePriceValueChangedMessagePayloadBuilder oldValue(
090            Function<com.commercetools.api.models.common.MoneyBuilder, com.commercetools.api.models.common.MoneyBuilder> builder) {
091        this.oldValue = builder.apply(com.commercetools.api.models.common.MoneyBuilder.of()).build();
092        return this;
093    }
094
095    /**
096     *  <p>The old value of the updated StandalonePrice. Present on Messages created after 3 February 2023. Optional for backwards compatibility.</p>
097     * @param builder function to build the oldValue value
098     * @return Builder
099     */
100
101    public StandalonePriceValueChangedMessagePayloadBuilder withOldValue(
102            Function<com.commercetools.api.models.common.MoneyBuilder, com.commercetools.api.models.common.Money> builder) {
103        this.oldValue = builder.apply(com.commercetools.api.models.common.MoneyBuilder.of());
104        return this;
105    }
106
107    /**
108     *  <p>The old value of the updated StandalonePrice. Present on Messages created after 3 February 2023. Optional for backwards compatibility.</p>
109     * @param oldValue value to be set
110     * @return Builder
111     */
112
113    public StandalonePriceValueChangedMessagePayloadBuilder oldValue(
114            @Nullable final com.commercetools.api.models.common.Money oldValue) {
115        this.oldValue = oldValue;
116        return this;
117    }
118
119    /**
120     *  <p>The new value of the updated StandalonePrice.</p>
121     * @return value
122     */
123
124    public com.commercetools.api.models.common.Money getValue() {
125        return this.value;
126    }
127
128    /**
129     *  <p>Whether the new value was applied to the current or the staged representation of the StandalonePrice. Staged changes are stored on the StagedStandalonePrice.</p>
130     * @return staged
131     */
132
133    public Boolean getStaged() {
134        return this.staged;
135    }
136
137    /**
138     *  <p>The old value of the updated StandalonePrice. Present on Messages created after 3 February 2023. Optional for backwards compatibility.</p>
139     * @return oldValue
140     */
141
142    @Nullable
143    public com.commercetools.api.models.common.Money getOldValue() {
144        return this.oldValue;
145    }
146
147    /**
148     * builds StandalonePriceValueChangedMessagePayload with checking for non-null required values
149     * @return StandalonePriceValueChangedMessagePayload
150     */
151    public StandalonePriceValueChangedMessagePayload build() {
152        Objects.requireNonNull(value, StandalonePriceValueChangedMessagePayload.class + ": value is missing");
153        Objects.requireNonNull(staged, StandalonePriceValueChangedMessagePayload.class + ": staged is missing");
154        return new StandalonePriceValueChangedMessagePayloadImpl(value, staged, oldValue);
155    }
156
157    /**
158     * builds StandalonePriceValueChangedMessagePayload without checking for non-null required values
159     * @return StandalonePriceValueChangedMessagePayload
160     */
161    public StandalonePriceValueChangedMessagePayload buildUnchecked() {
162        return new StandalonePriceValueChangedMessagePayloadImpl(value, staged, oldValue);
163    }
164
165    /**
166     * factory method for an instance of StandalonePriceValueChangedMessagePayloadBuilder
167     * @return builder
168     */
169    public static StandalonePriceValueChangedMessagePayloadBuilder of() {
170        return new StandalonePriceValueChangedMessagePayloadBuilder();
171    }
172
173    /**
174     * create builder for StandalonePriceValueChangedMessagePayload instance
175     * @param template instance with prefilled values for the builder
176     * @return builder
177     */
178    public static StandalonePriceValueChangedMessagePayloadBuilder of(
179            final StandalonePriceValueChangedMessagePayload template) {
180        StandalonePriceValueChangedMessagePayloadBuilder builder = new StandalonePriceValueChangedMessagePayloadBuilder();
181        builder.value = template.getValue();
182        builder.staged = template.getStaged();
183        builder.oldValue = template.getOldValue();
184        return builder;
185    }
186
187}