001
002package com.commercetools.api.models.order;
003
004import java.util.*;
005import java.util.function.Function;
006
007import io.vrap.rmf.base.client.Builder;
008import io.vrap.rmf.base.client.utils.Generated;
009
010/**
011 * OrderImportCustomLineItemStateActionBuilder
012 * <hr>
013 * Example to create an instance using the builder pattern
014 * <div class=code-example>
015 * <pre><code class='java'>
016 *     OrderImportCustomLineItemStateAction orderImportCustomLineItemStateAction = OrderImportCustomLineItemStateAction.builder()
017 *             .customLineItemId("{customLineItemId}")
018 *             .plusState(stateBuilder -> stateBuilder)
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 OrderImportCustomLineItemStateActionBuilder implements Builder<OrderImportCustomLineItemStateAction> {
025
026    private String customLineItemId;
027
028    private java.util.List<com.commercetools.api.models.order.ItemState> state;
029
030    /**
031     * set the value to the customLineItemId
032     * @param customLineItemId value to be set
033     * @return Builder
034     */
035
036    public OrderImportCustomLineItemStateActionBuilder customLineItemId(final String customLineItemId) {
037        this.customLineItemId = customLineItemId;
038        return this;
039    }
040
041    /**
042     * set values to the state
043     * @param state value to be set
044     * @return Builder
045     */
046
047    public OrderImportCustomLineItemStateActionBuilder state(
048            final com.commercetools.api.models.order.ItemState... state) {
049        this.state = new ArrayList<>(Arrays.asList(state));
050        return this;
051    }
052
053    /**
054     * set value to the state
055     * @param state value to be set
056     * @return Builder
057     */
058
059    public OrderImportCustomLineItemStateActionBuilder state(
060            final java.util.List<com.commercetools.api.models.order.ItemState> state) {
061        this.state = state;
062        return this;
063    }
064
065    /**
066     * add values to the state
067     * @param state value to be set
068     * @return Builder
069     */
070
071    public OrderImportCustomLineItemStateActionBuilder plusState(
072            final com.commercetools.api.models.order.ItemState... state) {
073        if (this.state == null) {
074            this.state = new ArrayList<>();
075        }
076        this.state.addAll(Arrays.asList(state));
077        return this;
078    }
079
080    /**
081     * add the value to the state using the builder function
082     * @param builder function to build the state value
083     * @return Builder
084     */
085
086    public OrderImportCustomLineItemStateActionBuilder plusState(
087            Function<com.commercetools.api.models.order.ItemStateBuilder, com.commercetools.api.models.order.ItemStateBuilder> builder) {
088        if (this.state == null) {
089            this.state = new ArrayList<>();
090        }
091        this.state.add(builder.apply(com.commercetools.api.models.order.ItemStateBuilder.of()).build());
092        return this;
093    }
094
095    /**
096     * set the value to the state using the builder function
097     * @param builder function to build the state value
098     * @return Builder
099     */
100
101    public OrderImportCustomLineItemStateActionBuilder withState(
102            Function<com.commercetools.api.models.order.ItemStateBuilder, com.commercetools.api.models.order.ItemStateBuilder> builder) {
103        this.state = new ArrayList<>();
104        this.state.add(builder.apply(com.commercetools.api.models.order.ItemStateBuilder.of()).build());
105        return this;
106    }
107
108    /**
109     * add the value to the state using the builder function
110     * @param builder function to build the state value
111     * @return Builder
112     */
113
114    public OrderImportCustomLineItemStateActionBuilder addState(
115            Function<com.commercetools.api.models.order.ItemStateBuilder, com.commercetools.api.models.order.ItemState> builder) {
116        return plusState(builder.apply(com.commercetools.api.models.order.ItemStateBuilder.of()));
117    }
118
119    /**
120     * set the value to the state using the builder function
121     * @param builder function to build the state value
122     * @return Builder
123     */
124
125    public OrderImportCustomLineItemStateActionBuilder setState(
126            Function<com.commercetools.api.models.order.ItemStateBuilder, com.commercetools.api.models.order.ItemState> builder) {
127        return state(builder.apply(com.commercetools.api.models.order.ItemStateBuilder.of()));
128    }
129
130    /**
131     * value of customLineItemId}
132     * @return customLineItemId
133     */
134
135    public String getCustomLineItemId() {
136        return this.customLineItemId;
137    }
138
139    /**
140     * value of state}
141     * @return state
142     */
143
144    public java.util.List<com.commercetools.api.models.order.ItemState> getState() {
145        return this.state;
146    }
147
148    /**
149     * builds OrderImportCustomLineItemStateAction with checking for non-null required values
150     * @return OrderImportCustomLineItemStateAction
151     */
152    public OrderImportCustomLineItemStateAction build() {
153        Objects.requireNonNull(customLineItemId,
154            OrderImportCustomLineItemStateAction.class + ": customLineItemId is missing");
155        Objects.requireNonNull(state, OrderImportCustomLineItemStateAction.class + ": state is missing");
156        return new OrderImportCustomLineItemStateActionImpl(customLineItemId, state);
157    }
158
159    /**
160     * builds OrderImportCustomLineItemStateAction without checking for non-null required values
161     * @return OrderImportCustomLineItemStateAction
162     */
163    public OrderImportCustomLineItemStateAction buildUnchecked() {
164        return new OrderImportCustomLineItemStateActionImpl(customLineItemId, state);
165    }
166
167    /**
168     * factory method for an instance of OrderImportCustomLineItemStateActionBuilder
169     * @return builder
170     */
171    public static OrderImportCustomLineItemStateActionBuilder of() {
172        return new OrderImportCustomLineItemStateActionBuilder();
173    }
174
175    /**
176     * create builder for OrderImportCustomLineItemStateAction instance
177     * @param template instance with prefilled values for the builder
178     * @return builder
179     */
180    public static OrderImportCustomLineItemStateActionBuilder of(final OrderImportCustomLineItemStateAction template) {
181        OrderImportCustomLineItemStateActionBuilder builder = new OrderImportCustomLineItemStateActionBuilder();
182        builder.customLineItemId = template.getCustomLineItemId();
183        builder.state = template.getState();
184        return builder;
185    }
186
187}