001
002package com.commercetools.history.models.change_value;
003
004import java.time.*;
005import java.util.*;
006import java.util.function.Function;
007
008import javax.annotation.Nullable;
009import javax.validation.constraints.NotNull;
010
011import com.fasterxml.jackson.annotation.*;
012import com.fasterxml.jackson.databind.annotation.*;
013
014import io.vrap.rmf.base.client.utils.Generated;
015
016/**
017 * AttributeValue
018 *
019 * <hr>
020 * Example to create an instance using the builder pattern
021 * <div class=code-example>
022 * <pre><code class='java'>
023 *     AttributeValue attributeValue = AttributeValue.builder()
024 *             .name("{name}")
025 *             .build()
026 * </code></pre>
027 * </div>
028 */
029@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
030@JsonDeserialize(as = AttributeValueImpl.class)
031public interface AttributeValue {
032
033    /**
034     *  <p>Name of the Attribute set.</p>
035     * @return name
036     */
037    @NotNull
038    @JsonProperty("name")
039    public String getName();
040
041    /**
042     *  <p>Value set for the Attribute determined by the AttributeType:</p>
043     *  <ul>
044     *   <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>
045     *   <li>For Localizable Text Type, <code>value</code> is the LocalizedString object.</li>
046     *   <li>For Money Type Attributes, <code>value</code> is the Money object.</li>
047     *   <li>For Set Type Attributes, <code>value</code> is the entire <code>set</code> object.</li>
048     *   <li>For Nested Type Attributes, <code>value</code> is the list of values of all Attributes of the nested Product.</li>
049     *   <li>For Reference Type Attributes, <code>value</code> is the Reference object.</li>
050     *  </ul>
051     * @return value
052     */
053    @NotNull
054    @JsonProperty("value")
055    public Object getValue();
056
057    /**
058     *  <p>Name of the Attribute set.</p>
059     * @param name value to be set
060     */
061
062    public void setName(final String name);
063
064    /**
065     *  <p>Value set for the Attribute determined by the AttributeType:</p>
066     *  <ul>
067     *   <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>
068     *   <li>For Localizable Text Type, <code>value</code> is the LocalizedString object.</li>
069     *   <li>For Money Type Attributes, <code>value</code> is the Money object.</li>
070     *   <li>For Set Type Attributes, <code>value</code> is the entire <code>set</code> object.</li>
071     *   <li>For Nested Type Attributes, <code>value</code> is the list of values of all Attributes of the nested Product.</li>
072     *   <li>For Reference Type Attributes, <code>value</code> is the Reference object.</li>
073     *  </ul>
074     * @param value value to be set
075     */
076
077    public void setValue(final Object value);
078
079    /**
080     * factory method
081     * @return instance of AttributeValue
082     */
083    public static AttributeValue of() {
084        return new AttributeValueImpl();
085    }
086
087    /**
088     * factory method to create a shallow copy AttributeValue
089     * @param template instance to be copied
090     * @return copy instance
091     */
092    public static AttributeValue of(final AttributeValue template) {
093        AttributeValueImpl instance = new AttributeValueImpl();
094        instance.setName(template.getName());
095        instance.setValue(template.getValue());
096        return instance;
097    }
098
099    /**
100     * factory method to create a deep copy of AttributeValue
101     * @param template instance to be copied
102     * @return copy instance
103     */
104    @Nullable
105    public static AttributeValue deepCopy(@Nullable final AttributeValue template) {
106        if (template == null) {
107            return null;
108        }
109        AttributeValueImpl instance = new AttributeValueImpl();
110        instance.setName(template.getName());
111        instance.setValue(template.getValue());
112        return instance;
113    }
114
115    /**
116     * builder factory method for AttributeValue
117     * @return builder
118     */
119    public static AttributeValueBuilder builder() {
120        return AttributeValueBuilder.of();
121    }
122
123    /**
124     * create builder for AttributeValue instance
125     * @param template instance with prefilled values for the builder
126     * @return builder
127     */
128    public static AttributeValueBuilder builder(final AttributeValue template) {
129        return AttributeValueBuilder.of(template);
130    }
131
132    /**
133     * accessor map function
134     * @param <T> mapped type
135     * @param helper function to map the object
136     * @return mapped value
137     */
138    default <T> T withAttributeValue(Function<AttributeValue, T> helper) {
139        return helper.apply(this);
140    }
141
142    /**
143     * gives a TypeReference for usage with Jackson DataBind
144     * @return TypeReference
145     */
146    public static com.fasterxml.jackson.core.type.TypeReference<AttributeValue> typeReference() {
147        return new com.fasterxml.jackson.core.type.TypeReference<AttributeValue>() {
148            @Override
149            public String toString() {
150                return "TypeReference<AttributeValue>";
151            }
152        };
153    }
154}