001
002package com.commercetools.history.models.change_value;
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 * FieldDefinitionOrderValueBuilder
012 * <hr>
013 * Example to create an instance using the builder pattern
014 * <div class=code-example>
015 * <pre><code class='java'>
016 *     FieldDefinitionOrderValue fieldDefinitionOrderValue = FieldDefinitionOrderValue.builder()
017 *             .name("{name}")
018 *             .label(labelBuilder -> labelBuilder)
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 FieldDefinitionOrderValueBuilder implements Builder<FieldDefinitionOrderValue> {
025
026    private String name;
027
028    private com.commercetools.history.models.common.LocalizedString label;
029
030    /**
031     *  <p>Name of the FieldDefinition.</p>
032     * @param name value to be set
033     * @return Builder
034     */
035
036    public FieldDefinitionOrderValueBuilder name(final String name) {
037        this.name = name;
038        return this;
039    }
040
041    /**
042     *  <p>Descriptive label of the field.</p>
043     * @param builder function to build the label value
044     * @return Builder
045     */
046
047    public FieldDefinitionOrderValueBuilder label(
048            Function<com.commercetools.history.models.common.LocalizedStringBuilder, com.commercetools.history.models.common.LocalizedStringBuilder> builder) {
049        this.label = builder.apply(com.commercetools.history.models.common.LocalizedStringBuilder.of()).build();
050        return this;
051    }
052
053    /**
054     *  <p>Descriptive label of the field.</p>
055     * @param builder function to build the label value
056     * @return Builder
057     */
058
059    public FieldDefinitionOrderValueBuilder withLabel(
060            Function<com.commercetools.history.models.common.LocalizedStringBuilder, com.commercetools.history.models.common.LocalizedString> builder) {
061        this.label = builder.apply(com.commercetools.history.models.common.LocalizedStringBuilder.of());
062        return this;
063    }
064
065    /**
066     *  <p>Descriptive label of the field.</p>
067     * @param label value to be set
068     * @return Builder
069     */
070
071    public FieldDefinitionOrderValueBuilder label(final com.commercetools.history.models.common.LocalizedString label) {
072        this.label = label;
073        return this;
074    }
075
076    /**
077     *  <p>Name of the FieldDefinition.</p>
078     * @return name
079     */
080
081    public String getName() {
082        return this.name;
083    }
084
085    /**
086     *  <p>Descriptive label of the field.</p>
087     * @return label
088     */
089
090    public com.commercetools.history.models.common.LocalizedString getLabel() {
091        return this.label;
092    }
093
094    /**
095     * builds FieldDefinitionOrderValue with checking for non-null required values
096     * @return FieldDefinitionOrderValue
097     */
098    public FieldDefinitionOrderValue build() {
099        Objects.requireNonNull(name, FieldDefinitionOrderValue.class + ": name is missing");
100        Objects.requireNonNull(label, FieldDefinitionOrderValue.class + ": label is missing");
101        return new FieldDefinitionOrderValueImpl(name, label);
102    }
103
104    /**
105     * builds FieldDefinitionOrderValue without checking for non-null required values
106     * @return FieldDefinitionOrderValue
107     */
108    public FieldDefinitionOrderValue buildUnchecked() {
109        return new FieldDefinitionOrderValueImpl(name, label);
110    }
111
112    /**
113     * factory method for an instance of FieldDefinitionOrderValueBuilder
114     * @return builder
115     */
116    public static FieldDefinitionOrderValueBuilder of() {
117        return new FieldDefinitionOrderValueBuilder();
118    }
119
120    /**
121     * create builder for FieldDefinitionOrderValue instance
122     * @param template instance with prefilled values for the builder
123     * @return builder
124     */
125    public static FieldDefinitionOrderValueBuilder of(final FieldDefinitionOrderValue template) {
126        FieldDefinitionOrderValueBuilder builder = new FieldDefinitionOrderValueBuilder();
127        builder.name = template.getName();
128        builder.label = template.getLabel();
129        return builder;
130    }
131
132}