001
002package com.commercetools.history.models.common;
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 * TextLineItemBuilder
012 * <hr>
013 * Example to create an instance using the builder pattern
014 * <div class=code-example>
015 * <pre><code class='java'>
016 *     TextLineItem textLineItem = TextLineItem.builder()
017 *             .addedAt("{addedAt}")
018 *             .custom(customBuilder -> customBuilder)
019 *             .description(descriptionBuilder -> descriptionBuilder)
020 *             .id("{id}")
021 *             .name(nameBuilder -> nameBuilder)
022 *             .quantity(1)
023 *             .build()
024 * </code></pre>
025 * </div>
026 */
027@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
028public class TextLineItemBuilder implements Builder<TextLineItem> {
029
030    private String addedAt;
031
032    private com.commercetools.history.models.common.CustomFields custom;
033
034    private com.commercetools.history.models.common.LocalizedString description;
035
036    private String id;
037
038    private com.commercetools.history.models.common.LocalizedString name;
039
040    private Integer quantity;
041
042    /**
043     * set the value to the addedAt
044     * @param addedAt value to be set
045     * @return Builder
046     */
047
048    public TextLineItemBuilder addedAt(final String addedAt) {
049        this.addedAt = addedAt;
050        return this;
051    }
052
053    /**
054     * set the value to the custom using the builder function
055     * @param builder function to build the custom value
056     * @return Builder
057     */
058
059    public TextLineItemBuilder custom(
060            Function<com.commercetools.history.models.common.CustomFieldsBuilder, com.commercetools.history.models.common.CustomFieldsBuilder> builder) {
061        this.custom = builder.apply(com.commercetools.history.models.common.CustomFieldsBuilder.of()).build();
062        return this;
063    }
064
065    /**
066     * set the value to the custom using the builder function
067     * @param builder function to build the custom value
068     * @return Builder
069     */
070
071    public TextLineItemBuilder withCustom(
072            Function<com.commercetools.history.models.common.CustomFieldsBuilder, com.commercetools.history.models.common.CustomFields> builder) {
073        this.custom = builder.apply(com.commercetools.history.models.common.CustomFieldsBuilder.of());
074        return this;
075    }
076
077    /**
078     * set the value to the custom
079     * @param custom value to be set
080     * @return Builder
081     */
082
083    public TextLineItemBuilder custom(final com.commercetools.history.models.common.CustomFields custom) {
084        this.custom = custom;
085        return this;
086    }
087
088    /**
089     * set the value to the description using the builder function
090     * @param builder function to build the description value
091     * @return Builder
092     */
093
094    public TextLineItemBuilder description(
095            Function<com.commercetools.history.models.common.LocalizedStringBuilder, com.commercetools.history.models.common.LocalizedStringBuilder> builder) {
096        this.description = builder.apply(com.commercetools.history.models.common.LocalizedStringBuilder.of()).build();
097        return this;
098    }
099
100    /**
101     * set the value to the description using the builder function
102     * @param builder function to build the description value
103     * @return Builder
104     */
105
106    public TextLineItemBuilder withDescription(
107            Function<com.commercetools.history.models.common.LocalizedStringBuilder, com.commercetools.history.models.common.LocalizedString> builder) {
108        this.description = builder.apply(com.commercetools.history.models.common.LocalizedStringBuilder.of());
109        return this;
110    }
111
112    /**
113     * set the value to the description
114     * @param description value to be set
115     * @return Builder
116     */
117
118    public TextLineItemBuilder description(final com.commercetools.history.models.common.LocalizedString description) {
119        this.description = description;
120        return this;
121    }
122
123    /**
124     * set the value to the id
125     * @param id value to be set
126     * @return Builder
127     */
128
129    public TextLineItemBuilder id(final String id) {
130        this.id = id;
131        return this;
132    }
133
134    /**
135     * set the value to the name using the builder function
136     * @param builder function to build the name value
137     * @return Builder
138     */
139
140    public TextLineItemBuilder name(
141            Function<com.commercetools.history.models.common.LocalizedStringBuilder, com.commercetools.history.models.common.LocalizedStringBuilder> builder) {
142        this.name = builder.apply(com.commercetools.history.models.common.LocalizedStringBuilder.of()).build();
143        return this;
144    }
145
146    /**
147     * set the value to the name using the builder function
148     * @param builder function to build the name value
149     * @return Builder
150     */
151
152    public TextLineItemBuilder withName(
153            Function<com.commercetools.history.models.common.LocalizedStringBuilder, com.commercetools.history.models.common.LocalizedString> builder) {
154        this.name = builder.apply(com.commercetools.history.models.common.LocalizedStringBuilder.of());
155        return this;
156    }
157
158    /**
159     * set the value to the name
160     * @param name value to be set
161     * @return Builder
162     */
163
164    public TextLineItemBuilder name(final com.commercetools.history.models.common.LocalizedString name) {
165        this.name = name;
166        return this;
167    }
168
169    /**
170     * set the value to the quantity
171     * @param quantity value to be set
172     * @return Builder
173     */
174
175    public TextLineItemBuilder quantity(final Integer quantity) {
176        this.quantity = quantity;
177        return this;
178    }
179
180    /**
181     * value of addedAt}
182     * @return addedAt
183     */
184
185    public String getAddedAt() {
186        return this.addedAt;
187    }
188
189    /**
190     * value of custom}
191     * @return custom
192     */
193
194    public com.commercetools.history.models.common.CustomFields getCustom() {
195        return this.custom;
196    }
197
198    /**
199     * value of description}
200     * @return description
201     */
202
203    public com.commercetools.history.models.common.LocalizedString getDescription() {
204        return this.description;
205    }
206
207    /**
208     * value of id}
209     * @return id
210     */
211
212    public String getId() {
213        return this.id;
214    }
215
216    /**
217     * value of name}
218     * @return name
219     */
220
221    public com.commercetools.history.models.common.LocalizedString getName() {
222        return this.name;
223    }
224
225    /**
226     * value of quantity}
227     * @return quantity
228     */
229
230    public Integer getQuantity() {
231        return this.quantity;
232    }
233
234    /**
235     * builds TextLineItem with checking for non-null required values
236     * @return TextLineItem
237     */
238    public TextLineItem build() {
239        Objects.requireNonNull(addedAt, TextLineItem.class + ": addedAt is missing");
240        Objects.requireNonNull(custom, TextLineItem.class + ": custom is missing");
241        Objects.requireNonNull(description, TextLineItem.class + ": description is missing");
242        Objects.requireNonNull(id, TextLineItem.class + ": id is missing");
243        Objects.requireNonNull(name, TextLineItem.class + ": name is missing");
244        Objects.requireNonNull(quantity, TextLineItem.class + ": quantity is missing");
245        return new TextLineItemImpl(addedAt, custom, description, id, name, quantity);
246    }
247
248    /**
249     * builds TextLineItem without checking for non-null required values
250     * @return TextLineItem
251     */
252    public TextLineItem buildUnchecked() {
253        return new TextLineItemImpl(addedAt, custom, description, id, name, quantity);
254    }
255
256    /**
257     * factory method for an instance of TextLineItemBuilder
258     * @return builder
259     */
260    public static TextLineItemBuilder of() {
261        return new TextLineItemBuilder();
262    }
263
264    /**
265     * create builder for TextLineItem instance
266     * @param template instance with prefilled values for the builder
267     * @return builder
268     */
269    public static TextLineItemBuilder of(final TextLineItem template) {
270        TextLineItemBuilder builder = new TextLineItemBuilder();
271        builder.addedAt = template.getAddedAt();
272        builder.custom = template.getCustom();
273        builder.description = template.getDescription();
274        builder.id = template.getId();
275        builder.name = template.getName();
276        builder.quantity = template.getQuantity();
277        return builder;
278    }
279
280}