001
002package com.commercetools.importapi.models.productvariants;
003
004import java.time.*;
005import java.util.*;
006import java.util.function.Function;
007import java.util.stream.Collectors;
008
009import javax.annotation.Nullable;
010import javax.validation.Valid;
011import javax.validation.constraints.NotNull;
012
013import com.commercetools.importapi.models.common.KeyReference;
014import com.fasterxml.jackson.annotation.*;
015import com.fasterxml.jackson.databind.annotation.*;
016
017import io.vrap.rmf.base.client.utils.Generated;
018
019/**
020 *  <p>This type represents an attribute whose value is a set of references.</p>
021 *
022 * <hr>
023 * Example to create an instance using the builder pattern
024 * <div class=code-example>
025 * <pre><code class='java'>
026 *     ReferenceSetAttribute referenceSetAttribute = ReferenceSetAttribute.builder()
027 *             .plusValue(valueBuilder -> valueBuilder)
028 *             .build()
029 * </code></pre>
030 * </div>
031 */
032@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
033@JsonDeserialize(as = ReferenceSetAttributeImpl.class)
034public interface ReferenceSetAttribute extends Attribute {
035
036    /**
037     * discriminator value for ReferenceSetAttribute
038     */
039    String REFERENCE_SET = "reference-set";
040
041    /**
042     *
043     * @return value
044     */
045    @NotNull
046    @Valid
047    @JsonProperty("value")
048    public List<KeyReference> getValue();
049
050    /**
051     * set value
052     * @param value values to be set
053     */
054
055    @JsonIgnore
056    public void setValue(final KeyReference... value);
057
058    /**
059     * set value
060     * @param value values to be set
061     */
062
063    public void setValue(final List<KeyReference> value);
064
065    /**
066     * factory method
067     * @return instance of ReferenceSetAttribute
068     */
069    public static ReferenceSetAttribute of() {
070        return new ReferenceSetAttributeImpl();
071    }
072
073    /**
074     * factory method to create a shallow copy ReferenceSetAttribute
075     * @param template instance to be copied
076     * @return copy instance
077     */
078    public static ReferenceSetAttribute of(final ReferenceSetAttribute template) {
079        ReferenceSetAttributeImpl instance = new ReferenceSetAttributeImpl();
080        instance.setName(template.getName());
081        instance.setValue(template.getValue());
082        return instance;
083    }
084
085    /**
086     * factory method to create a deep copy of ReferenceSetAttribute
087     * @param template instance to be copied
088     * @return copy instance
089     */
090    @Nullable
091    public static ReferenceSetAttribute deepCopy(@Nullable final ReferenceSetAttribute template) {
092        if (template == null) {
093            return null;
094        }
095        ReferenceSetAttributeImpl instance = new ReferenceSetAttributeImpl();
096        instance.setName(template.getName());
097        instance.setValue(Optional.ofNullable(template.getValue())
098                .map(t -> t.stream()
099                        .map(com.commercetools.importapi.models.common.KeyReference::deepCopy)
100                        .collect(Collectors.toList()))
101                .orElse(null));
102        return instance;
103    }
104
105    /**
106     * builder factory method for ReferenceSetAttribute
107     * @return builder
108     */
109    public static ReferenceSetAttributeBuilder builder() {
110        return ReferenceSetAttributeBuilder.of();
111    }
112
113    /**
114     * create builder for ReferenceSetAttribute instance
115     * @param template instance with prefilled values for the builder
116     * @return builder
117     */
118    public static ReferenceSetAttributeBuilder builder(final ReferenceSetAttribute template) {
119        return ReferenceSetAttributeBuilder.of(template);
120    }
121
122    /**
123     * accessor map function
124     * @param <T> mapped type
125     * @param helper function to map the object
126     * @return mapped value
127     */
128    default <T> T withReferenceSetAttribute(Function<ReferenceSetAttribute, T> helper) {
129        return helper.apply(this);
130    }
131
132    /**
133     * gives a TypeReference for usage with Jackson DataBind
134     * @return TypeReference
135     */
136    public static com.fasterxml.jackson.core.type.TypeReference<ReferenceSetAttribute> typeReference() {
137        return new com.fasterxml.jackson.core.type.TypeReference<ReferenceSetAttribute>() {
138            @Override
139            public String toString() {
140                return "TypeReference<ReferenceSetAttribute>";
141            }
142        };
143    }
144}