001
002package com.commercetools.api.models.payment;
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 * PaymentChangeAmountPlannedActionBuilder
012 * <hr>
013 * Example to create an instance using the builder pattern
014 * <div class=code-example>
015 * <pre><code class='java'>
016 *     PaymentChangeAmountPlannedAction paymentChangeAmountPlannedAction = PaymentChangeAmountPlannedAction.builder()
017 *             .amount(amountBuilder -> amountBuilder)
018 *             .build()
019 * </code></pre>
020 * </div>
021 */
022@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
023public class PaymentChangeAmountPlannedActionBuilder implements Builder<PaymentChangeAmountPlannedAction> {
024
025    private com.commercetools.api.models.common.Money amount;
026
027    /**
028     *  <p>New value to set.</p>
029     * @param builder function to build the amount value
030     * @return Builder
031     */
032
033    public PaymentChangeAmountPlannedActionBuilder amount(
034            Function<com.commercetools.api.models.common.MoneyBuilder, com.commercetools.api.models.common.MoneyBuilder> builder) {
035        this.amount = builder.apply(com.commercetools.api.models.common.MoneyBuilder.of()).build();
036        return this;
037    }
038
039    /**
040     *  <p>New value to set.</p>
041     * @param builder function to build the amount value
042     * @return Builder
043     */
044
045    public PaymentChangeAmountPlannedActionBuilder withAmount(
046            Function<com.commercetools.api.models.common.MoneyBuilder, com.commercetools.api.models.common.Money> builder) {
047        this.amount = builder.apply(com.commercetools.api.models.common.MoneyBuilder.of());
048        return this;
049    }
050
051    /**
052     *  <p>New value to set.</p>
053     * @param amount value to be set
054     * @return Builder
055     */
056
057    public PaymentChangeAmountPlannedActionBuilder amount(final com.commercetools.api.models.common.Money amount) {
058        this.amount = amount;
059        return this;
060    }
061
062    /**
063     *  <p>New value to set.</p>
064     * @return amount
065     */
066
067    public com.commercetools.api.models.common.Money getAmount() {
068        return this.amount;
069    }
070
071    /**
072     * builds PaymentChangeAmountPlannedAction with checking for non-null required values
073     * @return PaymentChangeAmountPlannedAction
074     */
075    public PaymentChangeAmountPlannedAction build() {
076        Objects.requireNonNull(amount, PaymentChangeAmountPlannedAction.class + ": amount is missing");
077        return new PaymentChangeAmountPlannedActionImpl(amount);
078    }
079
080    /**
081     * builds PaymentChangeAmountPlannedAction without checking for non-null required values
082     * @return PaymentChangeAmountPlannedAction
083     */
084    public PaymentChangeAmountPlannedAction buildUnchecked() {
085        return new PaymentChangeAmountPlannedActionImpl(amount);
086    }
087
088    /**
089     * factory method for an instance of PaymentChangeAmountPlannedActionBuilder
090     * @return builder
091     */
092    public static PaymentChangeAmountPlannedActionBuilder of() {
093        return new PaymentChangeAmountPlannedActionBuilder();
094    }
095
096    /**
097     * create builder for PaymentChangeAmountPlannedAction instance
098     * @param template instance with prefilled values for the builder
099     * @return builder
100     */
101    public static PaymentChangeAmountPlannedActionBuilder of(final PaymentChangeAmountPlannedAction template) {
102        PaymentChangeAmountPlannedActionBuilder builder = new PaymentChangeAmountPlannedActionBuilder();
103        builder.amount = template.getAmount();
104        return builder;
105    }
106
107}