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 the predicate defined in the ExtensionTrigger could not be evaluated due to a missing field.</p>
019 */
020@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
021public class GraphQLExtensionPredicateEvaluationFailedErrorImpl
022        implements GraphQLExtensionPredicateEvaluationFailedError, ModelBase {
023
024    private String code;
025
026    private Map<String, java.lang.Object> values;
027
028    private com.commercetools.api.models.error.ErrorByExtension errorByExtension;
029
030    /**
031     * create instance with all properties
032     */
033    @JsonCreator
034    GraphQLExtensionPredicateEvaluationFailedErrorImpl(
035            @JsonProperty("values") final Map<String, java.lang.Object> values,
036            @JsonProperty("errorByExtension") final com.commercetools.api.models.error.ErrorByExtension errorByExtension) {
037        this.values = values;
038        this.errorByExtension = errorByExtension;
039        this.code = EXTENSION_PREDICATE_EVALUATION_FAILED;
040    }
041
042    /**
043     * create empty instance
044     */
045    public GraphQLExtensionPredicateEvaluationFailedErrorImpl() {
046        this.code = EXTENSION_PREDICATE_EVALUATION_FAILED;
047    }
048
049    /**
050     *
051     */
052
053    public String getCode() {
054        return this.code;
055    }
056
057    /**
058     *  <p>Error-specific additional fields.</p>
059     */
060
061    public Map<String, java.lang.Object> values() {
062        return values;
063    }
064
065    /**
066     *  <p>Details about the API Extension that was involved in the error.</p>
067     */
068
069    public com.commercetools.api.models.error.ErrorByExtension getErrorByExtension() {
070        return this.errorByExtension;
071    }
072
073    public void setValue(String key, java.lang.Object value) {
074        if (values == null) {
075            values = new HashMap<>();
076        }
077        values.put(key, value);
078    }
079
080    public void setErrorByExtension(final com.commercetools.api.models.error.ErrorByExtension errorByExtension) {
081        this.errorByExtension = errorByExtension;
082    }
083
084    @Override
085    public boolean equals(Object o) {
086        if (this == o)
087            return true;
088
089        if (o == null || getClass() != o.getClass())
090            return false;
091
092        GraphQLExtensionPredicateEvaluationFailedErrorImpl that = (GraphQLExtensionPredicateEvaluationFailedErrorImpl) o;
093
094        return new EqualsBuilder().append(code, that.code)
095                .append(values, that.values)
096                .append(errorByExtension, that.errorByExtension)
097                .append(code, that.code)
098                .append(values, that.values)
099                .append(errorByExtension, that.errorByExtension)
100                .isEquals();
101    }
102
103    @Override
104    public int hashCode() {
105        return new HashCodeBuilder(17, 37).append(code).append(values).append(errorByExtension).toHashCode();
106    }
107
108}