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 * CustomFieldExpandedValueBuilder
012 * <hr>
013 * Example to create an instance using the builder pattern
014 * <div class=code-example>
015 * <pre><code class='java'>
016 *     CustomFieldExpandedValue customFieldExpandedValue = CustomFieldExpandedValue.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 CustomFieldExpandedValueBuilder implements Builder<CustomFieldExpandedValue> {
025
026    private String name;
027
028    private java.lang.Object value;
029
030    private com.commercetools.history.models.common.LocalizedString label;
031
032    /**
033     *  <p>Name of the Custom Field.</p>
034     * @param name value to be set
035     * @return Builder
036     */
037
038    public CustomFieldExpandedValueBuilder name(final String name) {
039        this.name = name;
040        return this;
041    }
042
043    /**
044     *  <p>CustomFieldValue based on the FieldType.</p>
045     * @param value value to be set
046     * @return Builder
047     */
048
049    public CustomFieldExpandedValueBuilder value(final java.lang.Object value) {
050        this.value = value;
051        return this;
052    }
053
054    /**
055     *  <p>User-defined label of the Custom Field.</p>
056     * @param builder function to build the label value
057     * @return Builder
058     */
059
060    public CustomFieldExpandedValueBuilder label(
061            Function<com.commercetools.history.models.common.LocalizedStringBuilder, com.commercetools.history.models.common.LocalizedStringBuilder> builder) {
062        this.label = builder.apply(com.commercetools.history.models.common.LocalizedStringBuilder.of()).build();
063        return this;
064    }
065
066    /**
067     *  <p>User-defined label of the Custom Field.</p>
068     * @param builder function to build the label value
069     * @return Builder
070     */
071
072    public CustomFieldExpandedValueBuilder withLabel(
073            Function<com.commercetools.history.models.common.LocalizedStringBuilder, com.commercetools.history.models.common.LocalizedString> builder) {
074        this.label = builder.apply(com.commercetools.history.models.common.LocalizedStringBuilder.of());
075        return this;
076    }
077
078    /**
079     *  <p>User-defined label of the Custom Field.</p>
080     * @param label value to be set
081     * @return Builder
082     */
083
084    public CustomFieldExpandedValueBuilder label(final com.commercetools.history.models.common.LocalizedString label) {
085        this.label = label;
086        return this;
087    }
088
089    /**
090     *  <p>Name of the Custom Field.</p>
091     * @return name
092     */
093
094    public String getName() {
095        return this.name;
096    }
097
098    /**
099     *  <p>CustomFieldValue based on the FieldType.</p>
100     * @return value
101     */
102
103    public java.lang.Object getValue() {
104        return this.value;
105    }
106
107    /**
108     *  <p>User-defined label of the Custom Field.</p>
109     * @return label
110     */
111
112    public com.commercetools.history.models.common.LocalizedString getLabel() {
113        return this.label;
114    }
115
116    /**
117     * builds CustomFieldExpandedValue with checking for non-null required values
118     * @return CustomFieldExpandedValue
119     */
120    public CustomFieldExpandedValue build() {
121        Objects.requireNonNull(name, CustomFieldExpandedValue.class + ": name is missing");
122        Objects.requireNonNull(value, CustomFieldExpandedValue.class + ": value is missing");
123        Objects.requireNonNull(label, CustomFieldExpandedValue.class + ": label is missing");
124        return new CustomFieldExpandedValueImpl(name, value, label);
125    }
126
127    /**
128     * builds CustomFieldExpandedValue without checking for non-null required values
129     * @return CustomFieldExpandedValue
130     */
131    public CustomFieldExpandedValue buildUnchecked() {
132        return new CustomFieldExpandedValueImpl(name, value, label);
133    }
134
135    /**
136     * factory method for an instance of CustomFieldExpandedValueBuilder
137     * @return builder
138     */
139    public static CustomFieldExpandedValueBuilder of() {
140        return new CustomFieldExpandedValueBuilder();
141    }
142
143    /**
144     * create builder for CustomFieldExpandedValue instance
145     * @param template instance with prefilled values for the builder
146     * @return builder
147     */
148    public static CustomFieldExpandedValueBuilder of(final CustomFieldExpandedValue template) {
149        CustomFieldExpandedValueBuilder builder = new CustomFieldExpandedValueBuilder();
150        builder.name = template.getName();
151        builder.value = template.getValue();
152        builder.label = template.getLabel();
153        return builder;
154    }
155
156}