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 ExtensionPredicateEvaluationFailedErrorImpl implements ExtensionPredicateEvaluationFailedError, ModelBase {
022
023    private String code;
024
025    private String message;
026
027    private Map<String, java.lang.Object> values;
028
029    private com.commercetools.api.models.error.ErrorByExtension errorByExtension;
030
031    /**
032     * create instance with all properties
033     */
034    @JsonCreator
035    ExtensionPredicateEvaluationFailedErrorImpl(@JsonProperty("message") final String message,
036            @JsonProperty("values") final Map<String, java.lang.Object> values,
037            @JsonProperty("errorByExtension") final com.commercetools.api.models.error.ErrorByExtension errorByExtension) {
038        this.message = message;
039        this.values = values;
040        this.errorByExtension = errorByExtension;
041        this.code = EXTENSION_PREDICATE_EVALUATION_FAILED;
042    }
043
044    /**
045     * create empty instance
046     */
047    public ExtensionPredicateEvaluationFailedErrorImpl() {
048        this.code = EXTENSION_PREDICATE_EVALUATION_FAILED;
049    }
050
051    /**
052     *
053     */
054
055    public String getCode() {
056        return this.code;
057    }
058
059    /**
060     *  <p><code>"The compared field $fieldName is not present."</code></p>
061     */
062
063    public String getMessage() {
064        return this.message;
065    }
066
067    /**
068     *  <p>Error-specific additional fields.</p>
069     */
070
071    public Map<String, java.lang.Object> values() {
072        return values;
073    }
074
075    /**
076     *  <p>Details about the API Extension that was involved in the error.</p>
077     */
078
079    public com.commercetools.api.models.error.ErrorByExtension getErrorByExtension() {
080        return this.errorByExtension;
081    }
082
083    public void setMessage(final String message) {
084        this.message = message;
085    }
086
087    public void setValue(String key, java.lang.Object value) {
088        if (values == null) {
089            values = new HashMap<>();
090        }
091        values.put(key, value);
092    }
093
094    public void setErrorByExtension(final com.commercetools.api.models.error.ErrorByExtension errorByExtension) {
095        this.errorByExtension = errorByExtension;
096    }
097
098    @Override
099    public boolean equals(Object o) {
100        if (this == o)
101            return true;
102
103        if (o == null || getClass() != o.getClass())
104            return false;
105
106        ExtensionPredicateEvaluationFailedErrorImpl that = (ExtensionPredicateEvaluationFailedErrorImpl) o;
107
108        return new EqualsBuilder().append(code, that.code)
109                .append(message, that.message)
110                .append(values, that.values)
111                .append(errorByExtension, that.errorByExtension)
112                .isEquals();
113    }
114
115    @Override
116    public int hashCode() {
117        return new HashCodeBuilder(17, 37).append(code)
118                .append(message)
119                .append(values)
120                .append(errorByExtension)
121                .toHashCode();
122    }
123
124}