001
002package com.commercetools.history.models.common;
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 * DiscountedLineItemPriceForQuantityBuilder
012 * <hr>
013 * Example to create an instance using the builder pattern
014 * <div class=code-example>
015 * <pre><code class='java'>
016 *     DiscountedLineItemPriceForQuantity discountedLineItemPriceForQuantity = DiscountedLineItemPriceForQuantity.builder()
017 *             .quantity(1)
018 *             .discountedPrice(discountedPriceBuilder -> discountedPriceBuilder)
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 DiscountedLineItemPriceForQuantityBuilder implements Builder<DiscountedLineItemPriceForQuantity> {
025
026    private Integer quantity;
027
028    private com.commercetools.history.models.common.DiscountedLineItemPrice discountedPrice;
029
030    /**
031     * set the value to the quantity
032     * @param quantity value to be set
033     * @return Builder
034     */
035
036    public DiscountedLineItemPriceForQuantityBuilder quantity(final Integer quantity) {
037        this.quantity = quantity;
038        return this;
039    }
040
041    /**
042     * set the value to the discountedPrice using the builder function
043     * @param builder function to build the discountedPrice value
044     * @return Builder
045     */
046
047    public DiscountedLineItemPriceForQuantityBuilder discountedPrice(
048            Function<com.commercetools.history.models.common.DiscountedLineItemPriceBuilder, com.commercetools.history.models.common.DiscountedLineItemPriceBuilder> builder) {
049        this.discountedPrice = builder
050                .apply(com.commercetools.history.models.common.DiscountedLineItemPriceBuilder.of())
051                .build();
052        return this;
053    }
054
055    /**
056     * set the value to the discountedPrice using the builder function
057     * @param builder function to build the discountedPrice value
058     * @return Builder
059     */
060
061    public DiscountedLineItemPriceForQuantityBuilder withDiscountedPrice(
062            Function<com.commercetools.history.models.common.DiscountedLineItemPriceBuilder, com.commercetools.history.models.common.DiscountedLineItemPrice> builder) {
063        this.discountedPrice = builder
064                .apply(com.commercetools.history.models.common.DiscountedLineItemPriceBuilder.of());
065        return this;
066    }
067
068    /**
069     * set the value to the discountedPrice
070     * @param discountedPrice value to be set
071     * @return Builder
072     */
073
074    public DiscountedLineItemPriceForQuantityBuilder discountedPrice(
075            final com.commercetools.history.models.common.DiscountedLineItemPrice discountedPrice) {
076        this.discountedPrice = discountedPrice;
077        return this;
078    }
079
080    /**
081     * value of quantity}
082     * @return quantity
083     */
084
085    public Integer getQuantity() {
086        return this.quantity;
087    }
088
089    /**
090     * value of discountedPrice}
091     * @return discountedPrice
092     */
093
094    public com.commercetools.history.models.common.DiscountedLineItemPrice getDiscountedPrice() {
095        return this.discountedPrice;
096    }
097
098    /**
099     * builds DiscountedLineItemPriceForQuantity with checking for non-null required values
100     * @return DiscountedLineItemPriceForQuantity
101     */
102    public DiscountedLineItemPriceForQuantity build() {
103        Objects.requireNonNull(quantity, DiscountedLineItemPriceForQuantity.class + ": quantity is missing");
104        Objects.requireNonNull(discountedPrice,
105            DiscountedLineItemPriceForQuantity.class + ": discountedPrice is missing");
106        return new DiscountedLineItemPriceForQuantityImpl(quantity, discountedPrice);
107    }
108
109    /**
110     * builds DiscountedLineItemPriceForQuantity without checking for non-null required values
111     * @return DiscountedLineItemPriceForQuantity
112     */
113    public DiscountedLineItemPriceForQuantity buildUnchecked() {
114        return new DiscountedLineItemPriceForQuantityImpl(quantity, discountedPrice);
115    }
116
117    /**
118     * factory method for an instance of DiscountedLineItemPriceForQuantityBuilder
119     * @return builder
120     */
121    public static DiscountedLineItemPriceForQuantityBuilder of() {
122        return new DiscountedLineItemPriceForQuantityBuilder();
123    }
124
125    /**
126     * create builder for DiscountedLineItemPriceForQuantity instance
127     * @param template instance with prefilled values for the builder
128     * @return builder
129     */
130    public static DiscountedLineItemPriceForQuantityBuilder of(final DiscountedLineItemPriceForQuantity template) {
131        DiscountedLineItemPriceForQuantityBuilder builder = new DiscountedLineItemPriceForQuantityBuilder();
132        builder.quantity = template.getQuantity();
133        builder.discountedPrice = template.getDiscountedPrice();
134        return builder;
135    }
136
137}