001
002package com.commercetools.api.models.cart;
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 * CartSetShippingCustomTypeActionBuilder
014 * <hr>
015 * Example to create an instance using the builder pattern
016 * <div class=code-example>
017 * <pre><code class='java'>
018 *     CartSetShippingCustomTypeAction cartSetShippingCustomTypeAction = CartSetShippingCustomTypeAction.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 CartSetShippingCustomTypeActionBuilder implements Builder<CartSetShippingCustomTypeAction> {
025
026    @Nullable
027    private String shippingKey;
028
029    @Nullable
030    private com.commercetools.api.models.type.TypeResourceIdentifier type;
031
032    @Nullable
033    private com.commercetools.api.models.type.FieldContainer fields;
034
035    /**
036     *  <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>
037     * @param shippingKey value to be set
038     * @return Builder
039     */
040
041    public CartSetShippingCustomTypeActionBuilder shippingKey(@Nullable final String shippingKey) {
042        this.shippingKey = shippingKey;
043        return this;
044    }
045
046    /**
047     *  <p>Defines the Type that extends the specified ShippingMethod with Custom Fields. If absent, any existing Type and Custom Fields are removed from the ShippingMethod.</p>
048     * @param builder function to build the type value
049     * @return Builder
050     */
051
052    public CartSetShippingCustomTypeActionBuilder type(
053            Function<com.commercetools.api.models.type.TypeResourceIdentifierBuilder, com.commercetools.api.models.type.TypeResourceIdentifierBuilder> builder) {
054        this.type = builder.apply(com.commercetools.api.models.type.TypeResourceIdentifierBuilder.of()).build();
055        return this;
056    }
057
058    /**
059     *  <p>Defines the Type that extends the specified ShippingMethod with Custom Fields. If absent, any existing Type and Custom Fields are removed from the ShippingMethod.</p>
060     * @param builder function to build the type value
061     * @return Builder
062     */
063
064    public CartSetShippingCustomTypeActionBuilder withType(
065            Function<com.commercetools.api.models.type.TypeResourceIdentifierBuilder, com.commercetools.api.models.type.TypeResourceIdentifier> builder) {
066        this.type = builder.apply(com.commercetools.api.models.type.TypeResourceIdentifierBuilder.of());
067        return this;
068    }
069
070    /**
071     *  <p>Defines the Type that extends the specified ShippingMethod with Custom Fields. If absent, any existing Type and Custom Fields are removed from the ShippingMethod.</p>
072     * @param type value to be set
073     * @return Builder
074     */
075
076    public CartSetShippingCustomTypeActionBuilder type(
077            @Nullable final com.commercetools.api.models.type.TypeResourceIdentifier type) {
078        this.type = type;
079        return this;
080    }
081
082    /**
083     *  <p>Sets the Custom Fields fields for the <code>shippingMethod</code>.</p>
084     * @param builder function to build the fields value
085     * @return Builder
086     */
087
088    public CartSetShippingCustomTypeActionBuilder fields(
089            Function<com.commercetools.api.models.type.FieldContainerBuilder, com.commercetools.api.models.type.FieldContainerBuilder> builder) {
090        this.fields = builder.apply(com.commercetools.api.models.type.FieldContainerBuilder.of()).build();
091        return this;
092    }
093
094    /**
095     *  <p>Sets the Custom Fields fields for the <code>shippingMethod</code>.</p>
096     * @param builder function to build the fields value
097     * @return Builder
098     */
099
100    public CartSetShippingCustomTypeActionBuilder withFields(
101            Function<com.commercetools.api.models.type.FieldContainerBuilder, com.commercetools.api.models.type.FieldContainer> builder) {
102        this.fields = builder.apply(com.commercetools.api.models.type.FieldContainerBuilder.of());
103        return this;
104    }
105
106    /**
107     *  <p>Sets the Custom Fields fields for the <code>shippingMethod</code>.</p>
108     * @param fields value to be set
109     * @return Builder
110     */
111
112    public CartSetShippingCustomTypeActionBuilder fields(
113            @Nullable final com.commercetools.api.models.type.FieldContainer fields) {
114        this.fields = fields;
115        return this;
116    }
117
118    /**
119     *  <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>
120     * @return shippingKey
121     */
122
123    @Nullable
124    public String getShippingKey() {
125        return this.shippingKey;
126    }
127
128    /**
129     *  <p>Defines the Type that extends the specified ShippingMethod with Custom Fields. If absent, any existing Type and Custom Fields are removed from the ShippingMethod.</p>
130     * @return type
131     */
132
133    @Nullable
134    public com.commercetools.api.models.type.TypeResourceIdentifier getType() {
135        return this.type;
136    }
137
138    /**
139     *  <p>Sets the Custom Fields fields for the <code>shippingMethod</code>.</p>
140     * @return fields
141     */
142
143    @Nullable
144    public com.commercetools.api.models.type.FieldContainer getFields() {
145        return this.fields;
146    }
147
148    /**
149     * builds CartSetShippingCustomTypeAction with checking for non-null required values
150     * @return CartSetShippingCustomTypeAction
151     */
152    public CartSetShippingCustomTypeAction build() {
153        return new CartSetShippingCustomTypeActionImpl(shippingKey, type, fields);
154    }
155
156    /**
157     * builds CartSetShippingCustomTypeAction without checking for non-null required values
158     * @return CartSetShippingCustomTypeAction
159     */
160    public CartSetShippingCustomTypeAction buildUnchecked() {
161        return new CartSetShippingCustomTypeActionImpl(shippingKey, type, fields);
162    }
163
164    /**
165     * factory method for an instance of CartSetShippingCustomTypeActionBuilder
166     * @return builder
167     */
168    public static CartSetShippingCustomTypeActionBuilder of() {
169        return new CartSetShippingCustomTypeActionBuilder();
170    }
171
172    /**
173     * create builder for CartSetShippingCustomTypeAction instance
174     * @param template instance with prefilled values for the builder
175     * @return builder
176     */
177    public static CartSetShippingCustomTypeActionBuilder of(final CartSetShippingCustomTypeAction template) {
178        CartSetShippingCustomTypeActionBuilder builder = new CartSetShippingCustomTypeActionBuilder();
179        builder.shippingKey = template.getShippingKey();
180        builder.type = template.getType();
181        builder.fields = template.getFields();
182        return builder;
183    }
184
185}