001
002package com.commercetools.api.models.cart;
003
004import java.util.*;
005
006import javax.annotation.Nullable;
007
008import io.vrap.rmf.base.client.Builder;
009import io.vrap.rmf.base.client.utils.Generated;
010
011/**
012 * CartSetShippingCustomFieldActionBuilder
013 * <hr>
014 * Example to create an instance using the builder pattern
015 * <div class=code-example>
016 * <pre><code class='java'>
017 *     CartSetShippingCustomFieldAction cartSetShippingCustomFieldAction = CartSetShippingCustomFieldAction.builder()
018 *             .name("{name}")
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 CartSetShippingCustomFieldActionBuilder implements Builder<CartSetShippingCustomFieldAction> {
025
026    @Nullable
027    private String shippingKey;
028
029    private String name;
030
031    @Nullable
032    private java.lang.Object value;
033
034    /**
035     *  <p>The <code>shippingKey</code> of the Shipping to customize. Used to specify which Shipping Method to customize on a Cart with <code>Multiple</code> ShippingMode. Leave this empty to customize the one and only ShippingMethod on a <code>Single</code> ShippingMode Cart.</p>
036     * @param shippingKey value to be set
037     * @return Builder
038     */
039
040    public CartSetShippingCustomFieldActionBuilder shippingKey(@Nullable final String shippingKey) {
041        this.shippingKey = shippingKey;
042        return this;
043    }
044
045    /**
046     *  <p>Name of the Custom Field.</p>
047     * @param name value to be set
048     * @return Builder
049     */
050
051    public CartSetShippingCustomFieldActionBuilder name(final String name) {
052        this.name = name;
053        return this;
054    }
055
056    /**
057     *  <p>If <code>value</code> is absent or <code>null</code>, this field will be removed if it exists. Trying to remove a field that does not exist will fail with an InvalidOperation error. If <code>value</code> is provided, it is set for the field defined by <code>name</code>.</p>
058     * @param value value to be set
059     * @return Builder
060     */
061
062    public CartSetShippingCustomFieldActionBuilder value(@Nullable final java.lang.Object value) {
063        this.value = value;
064        return this;
065    }
066
067    /**
068     *  <p>The <code>shippingKey</code> of the Shipping to customize. Used to specify which Shipping Method to customize on a Cart with <code>Multiple</code> ShippingMode. Leave this empty to customize the one and only ShippingMethod on a <code>Single</code> ShippingMode Cart.</p>
069     * @return shippingKey
070     */
071
072    @Nullable
073    public String getShippingKey() {
074        return this.shippingKey;
075    }
076
077    /**
078     *  <p>Name of the Custom Field.</p>
079     * @return name
080     */
081
082    public String getName() {
083        return this.name;
084    }
085
086    /**
087     *  <p>If <code>value</code> is absent or <code>null</code>, this field will be removed if it exists. Trying to remove a field that does not exist will fail with an InvalidOperation error. If <code>value</code> is provided, it is set for the field defined by <code>name</code>.</p>
088     * @return value
089     */
090
091    @Nullable
092    public java.lang.Object getValue() {
093        return this.value;
094    }
095
096    /**
097     * builds CartSetShippingCustomFieldAction with checking for non-null required values
098     * @return CartSetShippingCustomFieldAction
099     */
100    public CartSetShippingCustomFieldAction build() {
101        Objects.requireNonNull(name, CartSetShippingCustomFieldAction.class + ": name is missing");
102        return new CartSetShippingCustomFieldActionImpl(shippingKey, name, value);
103    }
104
105    /**
106     * builds CartSetShippingCustomFieldAction without checking for non-null required values
107     * @return CartSetShippingCustomFieldAction
108     */
109    public CartSetShippingCustomFieldAction buildUnchecked() {
110        return new CartSetShippingCustomFieldActionImpl(shippingKey, name, value);
111    }
112
113    /**
114     * factory method for an instance of CartSetShippingCustomFieldActionBuilder
115     * @return builder
116     */
117    public static CartSetShippingCustomFieldActionBuilder of() {
118        return new CartSetShippingCustomFieldActionBuilder();
119    }
120
121    /**
122     * create builder for CartSetShippingCustomFieldAction instance
123     * @param template instance with prefilled values for the builder
124     * @return builder
125     */
126    public static CartSetShippingCustomFieldActionBuilder of(final CartSetShippingCustomFieldAction template) {
127        CartSetShippingCustomFieldActionBuilder builder = new CartSetShippingCustomFieldActionBuilder();
128        builder.shippingKey = template.getShippingKey();
129        builder.name = template.getName();
130        builder.value = template.getValue();
131        return builder;
132    }
133
134}