001
002package com.commercetools.api.models.order;
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 * OrderSetItemShippingAddressCustomTypeActionBuilder
014 * <hr>
015 * Example to create an instance using the builder pattern
016 * <div class=code-example>
017 * <pre><code class='java'>
018 *     OrderSetItemShippingAddressCustomTypeAction orderSetItemShippingAddressCustomTypeAction = OrderSetItemShippingAddressCustomTypeAction.builder()
019 *             .addressKey("{addressKey}")
020 *             .build()
021 * </code></pre>
022 * </div>
023 */
024@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
025public class OrderSetItemShippingAddressCustomTypeActionBuilder
026        implements Builder<OrderSetItemShippingAddressCustomTypeAction> {
027
028    private String addressKey;
029
030    @Nullable
031    private com.commercetools.api.models.type.TypeResourceIdentifier type;
032
033    @Nullable
034    private com.commercetools.api.models.type.FieldContainer fields;
035
036    /**
037     * set the value to the addressKey
038     * @param addressKey value to be set
039     * @return Builder
040     */
041
042    public OrderSetItemShippingAddressCustomTypeActionBuilder addressKey(final String addressKey) {
043        this.addressKey = addressKey;
044        return this;
045    }
046
047    /**
048     *  <p>Defines the Type that extends the <code>itemShippingAddress</code> with Custom Fields. If absent, any existing Type and Custom Fields are removed from the <code>itemShippingAddress</code>.</p>
049     * @param builder function to build the type value
050     * @return Builder
051     */
052
053    public OrderSetItemShippingAddressCustomTypeActionBuilder type(
054            Function<com.commercetools.api.models.type.TypeResourceIdentifierBuilder, com.commercetools.api.models.type.TypeResourceIdentifierBuilder> builder) {
055        this.type = builder.apply(com.commercetools.api.models.type.TypeResourceIdentifierBuilder.of()).build();
056        return this;
057    }
058
059    /**
060     *  <p>Defines the Type that extends the <code>itemShippingAddress</code> with Custom Fields. If absent, any existing Type and Custom Fields are removed from the <code>itemShippingAddress</code>.</p>
061     * @param builder function to build the type value
062     * @return Builder
063     */
064
065    public OrderSetItemShippingAddressCustomTypeActionBuilder withType(
066            Function<com.commercetools.api.models.type.TypeResourceIdentifierBuilder, com.commercetools.api.models.type.TypeResourceIdentifier> builder) {
067        this.type = builder.apply(com.commercetools.api.models.type.TypeResourceIdentifierBuilder.of());
068        return this;
069    }
070
071    /**
072     *  <p>Defines the Type that extends the <code>itemShippingAddress</code> with Custom Fields. If absent, any existing Type and Custom Fields are removed from the <code>itemShippingAddress</code>.</p>
073     * @param type value to be set
074     * @return Builder
075     */
076
077    public OrderSetItemShippingAddressCustomTypeActionBuilder type(
078            @Nullable final com.commercetools.api.models.type.TypeResourceIdentifier type) {
079        this.type = type;
080        return this;
081    }
082
083    /**
084     *  <p>Sets the Custom Fields fields for the <code>itemShippingAddress</code>.</p>
085     * @param builder function to build the fields value
086     * @return Builder
087     */
088
089    public OrderSetItemShippingAddressCustomTypeActionBuilder fields(
090            Function<com.commercetools.api.models.type.FieldContainerBuilder, com.commercetools.api.models.type.FieldContainerBuilder> builder) {
091        this.fields = builder.apply(com.commercetools.api.models.type.FieldContainerBuilder.of()).build();
092        return this;
093    }
094
095    /**
096     *  <p>Sets the Custom Fields fields for the <code>itemShippingAddress</code>.</p>
097     * @param builder function to build the fields value
098     * @return Builder
099     */
100
101    public OrderSetItemShippingAddressCustomTypeActionBuilder withFields(
102            Function<com.commercetools.api.models.type.FieldContainerBuilder, com.commercetools.api.models.type.FieldContainer> builder) {
103        this.fields = builder.apply(com.commercetools.api.models.type.FieldContainerBuilder.of());
104        return this;
105    }
106
107    /**
108     *  <p>Sets the Custom Fields fields for the <code>itemShippingAddress</code>.</p>
109     * @param fields value to be set
110     * @return Builder
111     */
112
113    public OrderSetItemShippingAddressCustomTypeActionBuilder fields(
114            @Nullable final com.commercetools.api.models.type.FieldContainer fields) {
115        this.fields = fields;
116        return this;
117    }
118
119    /**
120     * value of addressKey}
121     * @return addressKey
122     */
123
124    public String getAddressKey() {
125        return this.addressKey;
126    }
127
128    /**
129     *  <p>Defines the Type that extends the <code>itemShippingAddress</code> with Custom Fields. If absent, any existing Type and Custom Fields are removed from the <code>itemShippingAddress</code>.</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>itemShippingAddress</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 OrderSetItemShippingAddressCustomTypeAction with checking for non-null required values
150     * @return OrderSetItemShippingAddressCustomTypeAction
151     */
152    public OrderSetItemShippingAddressCustomTypeAction build() {
153        Objects.requireNonNull(addressKey,
154            OrderSetItemShippingAddressCustomTypeAction.class + ": addressKey is missing");
155        return new OrderSetItemShippingAddressCustomTypeActionImpl(addressKey, type, fields);
156    }
157
158    /**
159     * builds OrderSetItemShippingAddressCustomTypeAction without checking for non-null required values
160     * @return OrderSetItemShippingAddressCustomTypeAction
161     */
162    public OrderSetItemShippingAddressCustomTypeAction buildUnchecked() {
163        return new OrderSetItemShippingAddressCustomTypeActionImpl(addressKey, type, fields);
164    }
165
166    /**
167     * factory method for an instance of OrderSetItemShippingAddressCustomTypeActionBuilder
168     * @return builder
169     */
170    public static OrderSetItemShippingAddressCustomTypeActionBuilder of() {
171        return new OrderSetItemShippingAddressCustomTypeActionBuilder();
172    }
173
174    /**
175     * create builder for OrderSetItemShippingAddressCustomTypeAction instance
176     * @param template instance with prefilled values for the builder
177     * @return builder
178     */
179    public static OrderSetItemShippingAddressCustomTypeActionBuilder of(
180            final OrderSetItemShippingAddressCustomTypeAction template) {
181        OrderSetItemShippingAddressCustomTypeActionBuilder builder = new OrderSetItemShippingAddressCustomTypeActionBuilder();
182        builder.addressKey = template.getAddressKey();
183        builder.type = template.getType();
184        builder.fields = template.getFields();
185        return builder;
186    }
187
188}