001
002package com.commercetools.history.models.change_value;
003
004import java.util.*;
005
006import io.vrap.rmf.base.client.Builder;
007import io.vrap.rmf.base.client.utils.Generated;
008
009/**
010 * AttributeValueBuilder
011 * <hr>
012 * Example to create an instance using the builder pattern
013 * <div class=code-example>
014 * <pre><code class='java'>
015 *     AttributeValue attributeValue = AttributeValue.builder()
016 *             .name("{name}")
017 *             .build()
018 * </code></pre>
019 * </div>
020 */
021@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
022public class AttributeValueBuilder implements Builder<AttributeValue> {
023
024    private String name;
025
026    private java.lang.Object value;
027
028    /**
029     *  <p>Name of the Attribute set.</p>
030     * @param name value to be set
031     * @return Builder
032     */
033
034    public AttributeValueBuilder name(final String name) {
035        this.name = name;
036        return this;
037    }
038
039    /**
040     *  <p>Value set for the Attribute determined by the AttributeType:</p>
041     *  <ul>
042     *   <li>For Enum Type and Localized Enum Type, <code>value</code> is the <code>key</code> of the Plain Enum Value or Localized Enum Value objects, or the complete objects.</li>
043     *   <li>For Localizable Text Type, <code>value</code> is the LocalizedString object.</li>
044     *   <li>For Money Type Attributes, <code>value</code> is the Money object.</li>
045     *   <li>For Set Type Attributes, <code>value</code> is the entire <code>set</code> object.</li>
046     *   <li>For Nested Type Attributes, <code>value</code> is the list of values of all Attributes of the nested Product.</li>
047     *   <li>For Reference Type Attributes, <code>value</code> is the Reference object.</li>
048     *  </ul>
049     * @param value value to be set
050     * @return Builder
051     */
052
053    public AttributeValueBuilder value(final java.lang.Object value) {
054        this.value = value;
055        return this;
056    }
057
058    /**
059     *  <p>Name of the Attribute set.</p>
060     * @return name
061     */
062
063    public String getName() {
064        return this.name;
065    }
066
067    /**
068     *  <p>Value set for the Attribute determined by the AttributeType:</p>
069     *  <ul>
070     *   <li>For Enum Type and Localized Enum Type, <code>value</code> is the <code>key</code> of the Plain Enum Value or Localized Enum Value objects, or the complete objects.</li>
071     *   <li>For Localizable Text Type, <code>value</code> is the LocalizedString object.</li>
072     *   <li>For Money Type Attributes, <code>value</code> is the Money object.</li>
073     *   <li>For Set Type Attributes, <code>value</code> is the entire <code>set</code> object.</li>
074     *   <li>For Nested Type Attributes, <code>value</code> is the list of values of all Attributes of the nested Product.</li>
075     *   <li>For Reference Type Attributes, <code>value</code> is the Reference object.</li>
076     *  </ul>
077     * @return value
078     */
079
080    public java.lang.Object getValue() {
081        return this.value;
082    }
083
084    /**
085     * builds AttributeValue with checking for non-null required values
086     * @return AttributeValue
087     */
088    public AttributeValue build() {
089        Objects.requireNonNull(name, AttributeValue.class + ": name is missing");
090        Objects.requireNonNull(value, AttributeValue.class + ": value is missing");
091        return new AttributeValueImpl(name, value);
092    }
093
094    /**
095     * builds AttributeValue without checking for non-null required values
096     * @return AttributeValue
097     */
098    public AttributeValue buildUnchecked() {
099        return new AttributeValueImpl(name, value);
100    }
101
102    /**
103     * factory method for an instance of AttributeValueBuilder
104     * @return builder
105     */
106    public static AttributeValueBuilder of() {
107        return new AttributeValueBuilder();
108    }
109
110    /**
111     * create builder for AttributeValue instance
112     * @param template instance with prefilled values for the builder
113     * @return builder
114     */
115    public static AttributeValueBuilder of(final AttributeValue template) {
116        AttributeValueBuilder builder = new AttributeValueBuilder();
117        builder.name = template.getName();
118        builder.value = template.getValue();
119        return builder;
120    }
121
122}