001
002package com.commercetools.importapi.models.errors;
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.productvariants.Attribute;
014import com.fasterxml.jackson.annotation.*;
015import com.fasterxml.jackson.databind.annotation.*;
016
017import io.vrap.rmf.base.client.utils.Generated;
018
019/**
020 *  <p>The <code>CombinationUnique</code> AttributeConstraintEnum was violated.</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 *     DuplicateAttributeValuesError duplicateAttributeValuesError = DuplicateAttributeValuesError.builder()
027 *             .message("{message}")
028 *             .plusAttributes(attributesBuilder -> attributesBuilder)
029 *             .build()
030 * </code></pre>
031 * </div>
032 */
033@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
034@JsonDeserialize(as = DuplicateAttributeValuesErrorImpl.class)
035public interface DuplicateAttributeValuesError extends ErrorObject {
036
037    /**
038     * discriminator value for DuplicateAttributeValuesError
039     */
040    String DUPLICATE_ATTRIBUTE_VALUES = "DuplicateAttributeValues";
041
042    /**
043     *
044     * @return attributes
045     */
046    @NotNull
047    @Valid
048    @JsonProperty("attributes")
049    public List<Attribute> getAttributes();
050
051    /**
052     * set attributes
053     * @param attributes values to be set
054     */
055
056    @JsonIgnore
057    public void setAttributes(final Attribute... attributes);
058
059    /**
060     * set attributes
061     * @param attributes values to be set
062     */
063
064    public void setAttributes(final List<Attribute> attributes);
065
066    /**
067     * factory method
068     * @return instance of DuplicateAttributeValuesError
069     */
070    public static DuplicateAttributeValuesError of() {
071        return new DuplicateAttributeValuesErrorImpl();
072    }
073
074    /**
075     * factory method to create a shallow copy DuplicateAttributeValuesError
076     * @param template instance to be copied
077     * @return copy instance
078     */
079    public static DuplicateAttributeValuesError of(final DuplicateAttributeValuesError template) {
080        DuplicateAttributeValuesErrorImpl instance = new DuplicateAttributeValuesErrorImpl();
081        instance.setMessage(template.getMessage());
082        instance.setAttributes(template.getAttributes());
083        return instance;
084    }
085
086    /**
087     * factory method to create a deep copy of DuplicateAttributeValuesError
088     * @param template instance to be copied
089     * @return copy instance
090     */
091    @Nullable
092    public static DuplicateAttributeValuesError deepCopy(@Nullable final DuplicateAttributeValuesError template) {
093        if (template == null) {
094            return null;
095        }
096        DuplicateAttributeValuesErrorImpl instance = new DuplicateAttributeValuesErrorImpl();
097        instance.setMessage(template.getMessage());
098        instance.setAttributes(Optional.ofNullable(template.getAttributes())
099                .map(t -> t.stream()
100                        .map(com.commercetools.importapi.models.productvariants.Attribute::deepCopy)
101                        .collect(Collectors.toList()))
102                .orElse(null));
103        return instance;
104    }
105
106    /**
107     * builder factory method for DuplicateAttributeValuesError
108     * @return builder
109     */
110    public static DuplicateAttributeValuesErrorBuilder builder() {
111        return DuplicateAttributeValuesErrorBuilder.of();
112    }
113
114    /**
115     * create builder for DuplicateAttributeValuesError instance
116     * @param template instance with prefilled values for the builder
117     * @return builder
118     */
119    public static DuplicateAttributeValuesErrorBuilder builder(final DuplicateAttributeValuesError template) {
120        return DuplicateAttributeValuesErrorBuilder.of(template);
121    }
122
123    /**
124     * accessor map function
125     * @param <T> mapped type
126     * @param helper function to map the object
127     * @return mapped value
128     */
129    default <T> T withDuplicateAttributeValuesError(Function<DuplicateAttributeValuesError, T> helper) {
130        return helper.apply(this);
131    }
132
133    /**
134     * gives a TypeReference for usage with Jackson DataBind
135     * @return TypeReference
136     */
137    public static com.fasterxml.jackson.core.type.TypeReference<DuplicateAttributeValuesError> typeReference() {
138        return new com.fasterxml.jackson.core.type.TypeReference<DuplicateAttributeValuesError>() {
139            @Override
140            public String toString() {
141                return "TypeReference<DuplicateAttributeValuesError>";
142            }
143        };
144    }
145}