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