001
002package com.commercetools.api.models.error;
003
004import java.time.*;
005import java.util.*;
006
007import com.fasterxml.jackson.annotation.JsonCreator;
008import com.fasterxml.jackson.annotation.JsonProperty;
009import com.fasterxml.jackson.databind.annotation.*;
010
011import io.vrap.rmf.base.client.ModelBase;
012import io.vrap.rmf.base.client.utils.Generated;
013
014import org.apache.commons.lang3.builder.EqualsBuilder;
015import org.apache.commons.lang3.builder.HashCodeBuilder;
016
017/**
018 *  <p>Returned when an AttributeEnumType or AttributeLocalizedEnumType already contains a value with the given key.</p>
019 *  <p>The error is returned as a failed response to the Change the key of an EnumValue update action.</p>
020 */
021@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
022public class GraphQLEnumKeyDoesNotExistErrorImpl implements GraphQLEnumKeyDoesNotExistError, ModelBase {
023
024    private String code;
025
026    private Map<String, java.lang.Object> values;
027
028    private String conflictingEnumKey;
029
030    private String conflictingAttributeName;
031
032    /**
033     * create instance with all properties
034     */
035    @JsonCreator
036    GraphQLEnumKeyDoesNotExistErrorImpl(@JsonProperty("values") final Map<String, java.lang.Object> values,
037            @JsonProperty("conflictingEnumKey") final String conflictingEnumKey,
038            @JsonProperty("conflictingAttributeName") final String conflictingAttributeName) {
039        this.values = values;
040        this.conflictingEnumKey = conflictingEnumKey;
041        this.conflictingAttributeName = conflictingAttributeName;
042        this.code = ENUM_KEY_DOES_NOT_EXIST;
043    }
044
045    /**
046     * create empty instance
047     */
048    public GraphQLEnumKeyDoesNotExistErrorImpl() {
049        this.code = ENUM_KEY_DOES_NOT_EXIST;
050    }
051
052    /**
053     *
054     */
055
056    public String getCode() {
057        return this.code;
058    }
059
060    /**
061     *  <p>Error-specific additional fields.</p>
062     */
063
064    public Map<String, java.lang.Object> values() {
065        return values;
066    }
067
068    /**
069     *  <p>Conflicting enum key.</p>
070     */
071
072    public String getConflictingEnumKey() {
073        return this.conflictingEnumKey;
074    }
075
076    /**
077     *  <p>Name of the conflicting Attribute.</p>
078     */
079
080    public String getConflictingAttributeName() {
081        return this.conflictingAttributeName;
082    }
083
084    public void setValue(String key, java.lang.Object value) {
085        if (values == null) {
086            values = new HashMap<>();
087        }
088        values.put(key, value);
089    }
090
091    public void setConflictingEnumKey(final String conflictingEnumKey) {
092        this.conflictingEnumKey = conflictingEnumKey;
093    }
094
095    public void setConflictingAttributeName(final String conflictingAttributeName) {
096        this.conflictingAttributeName = conflictingAttributeName;
097    }
098
099    @Override
100    public boolean equals(Object o) {
101        if (this == o)
102            return true;
103
104        if (o == null || getClass() != o.getClass())
105            return false;
106
107        GraphQLEnumKeyDoesNotExistErrorImpl that = (GraphQLEnumKeyDoesNotExistErrorImpl) o;
108
109        return new EqualsBuilder().append(code, that.code)
110                .append(values, that.values)
111                .append(conflictingEnumKey, that.conflictingEnumKey)
112                .append(conflictingAttributeName, that.conflictingAttributeName)
113                .append(code, that.code)
114                .append(values, that.values)
115                .append(conflictingEnumKey, that.conflictingEnumKey)
116                .append(conflictingAttributeName, that.conflictingAttributeName)
117                .isEquals();
118    }
119
120    @Override
121    public int hashCode() {
122        return new HashCodeBuilder(17, 37).append(code)
123                .append(values)
124                .append(conflictingEnumKey)
125                .append(conflictingAttributeName)
126                .toHashCode();
127    }
128
129}