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 * StandalonePriceExternalDiscountSetMessagePayloadBuilder
014 * <hr>
015 * Example to create an instance using the builder pattern
016 * <div class=code-example>
017 * <pre><code class='java'>
018 *     StandalonePriceExternalDiscountSetMessagePayload standalonePriceExternalDiscountSetMessagePayload = StandalonePriceExternalDiscountSetMessagePayload.builder()
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 StandalonePriceExternalDiscountSetMessagePayloadBuilder
025        implements Builder<StandalonePriceExternalDiscountSetMessagePayload> {
026
027    @Nullable
028    private com.commercetools.api.models.common.DiscountedPrice discounted;
029
030    /**
031     *  <p>The <code>discounted</code> value of the StandalonePrice after the Set Discounted Price update action.</p>
032     * @param builder function to build the discounted value
033     * @return Builder
034     */
035
036    public StandalonePriceExternalDiscountSetMessagePayloadBuilder discounted(
037            Function<com.commercetools.api.models.common.DiscountedPriceBuilder, com.commercetools.api.models.common.DiscountedPriceBuilder> builder) {
038        this.discounted = builder.apply(com.commercetools.api.models.common.DiscountedPriceBuilder.of()).build();
039        return this;
040    }
041
042    /**
043     *  <p>The <code>discounted</code> value of the StandalonePrice after the Set Discounted Price update action.</p>
044     * @param builder function to build the discounted value
045     * @return Builder
046     */
047
048    public StandalonePriceExternalDiscountSetMessagePayloadBuilder withDiscounted(
049            Function<com.commercetools.api.models.common.DiscountedPriceBuilder, com.commercetools.api.models.common.DiscountedPrice> builder) {
050        this.discounted = builder.apply(com.commercetools.api.models.common.DiscountedPriceBuilder.of());
051        return this;
052    }
053
054    /**
055     *  <p>The <code>discounted</code> value of the StandalonePrice after the Set Discounted Price update action.</p>
056     * @param discounted value to be set
057     * @return Builder
058     */
059
060    public StandalonePriceExternalDiscountSetMessagePayloadBuilder discounted(
061            @Nullable final com.commercetools.api.models.common.DiscountedPrice discounted) {
062        this.discounted = discounted;
063        return this;
064    }
065
066    /**
067     *  <p>The <code>discounted</code> value of the StandalonePrice after the Set Discounted Price update action.</p>
068     * @return discounted
069     */
070
071    @Nullable
072    public com.commercetools.api.models.common.DiscountedPrice getDiscounted() {
073        return this.discounted;
074    }
075
076    /**
077     * builds StandalonePriceExternalDiscountSetMessagePayload with checking for non-null required values
078     * @return StandalonePriceExternalDiscountSetMessagePayload
079     */
080    public StandalonePriceExternalDiscountSetMessagePayload build() {
081        return new StandalonePriceExternalDiscountSetMessagePayloadImpl(discounted);
082    }
083
084    /**
085     * builds StandalonePriceExternalDiscountSetMessagePayload without checking for non-null required values
086     * @return StandalonePriceExternalDiscountSetMessagePayload
087     */
088    public StandalonePriceExternalDiscountSetMessagePayload buildUnchecked() {
089        return new StandalonePriceExternalDiscountSetMessagePayloadImpl(discounted);
090    }
091
092    /**
093     * factory method for an instance of StandalonePriceExternalDiscountSetMessagePayloadBuilder
094     * @return builder
095     */
096    public static StandalonePriceExternalDiscountSetMessagePayloadBuilder of() {
097        return new StandalonePriceExternalDiscountSetMessagePayloadBuilder();
098    }
099
100    /**
101     * create builder for StandalonePriceExternalDiscountSetMessagePayload instance
102     * @param template instance with prefilled values for the builder
103     * @return builder
104     */
105    public static StandalonePriceExternalDiscountSetMessagePayloadBuilder of(
106            final StandalonePriceExternalDiscountSetMessagePayload template) {
107        StandalonePriceExternalDiscountSetMessagePayloadBuilder builder = new StandalonePriceExternalDiscountSetMessagePayloadBuilder();
108        builder.discounted = template.getDiscounted();
109        return builder;
110    }
111
112}