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