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 a Discount predicate or API Extension predicate is not semantically correct.</p> 019 */ 020@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen") 021public class SemanticErrorErrorImpl implements SemanticErrorError, ModelBase { 022 023 private String code; 024 025 private String message; 026 027 private Map<String, java.lang.Object> values; 028 029 /** 030 * create instance with all properties 031 */ 032 @JsonCreator 033 SemanticErrorErrorImpl(@JsonProperty("message") final String message, 034 @JsonProperty("values") final Map<String, java.lang.Object> values) { 035 this.message = message; 036 this.values = values; 037 this.code = SEMANTIC_ERROR; 038 } 039 040 /** 041 * create empty instance 042 */ 043 public SemanticErrorErrorImpl() { 044 this.code = SEMANTIC_ERROR; 045 } 046 047 /** 048 * 049 */ 050 051 public String getCode() { 052 return this.code; 053 } 054 055 /** 056 * <p>Plain text description of the error concerning the predicate. For example, <code>"Invalid country code $countryCode provided for the field $fieldDefinition."</code>.</p> 057 */ 058 059 public String getMessage() { 060 return this.message; 061 } 062 063 /** 064 * <p>Error-specific additional fields.</p> 065 */ 066 067 public Map<String, java.lang.Object> values() { 068 return values; 069 } 070 071 public void setMessage(final String message) { 072 this.message = message; 073 } 074 075 public void setValue(String key, java.lang.Object value) { 076 if (values == null) { 077 values = new HashMap<>(); 078 } 079 values.put(key, value); 080 } 081 082 @Override 083 public boolean equals(Object o) { 084 if (this == o) 085 return true; 086 087 if (o == null || getClass() != o.getClass()) 088 return false; 089 090 SemanticErrorErrorImpl that = (SemanticErrorErrorImpl) o; 091 092 return new EqualsBuilder().append(code, that.code) 093 .append(message, that.message) 094 .append(values, that.values) 095 .append(code, that.code) 096 .append(message, that.message) 097 .append(values, that.values) 098 .isEquals(); 099 } 100 101 @Override 102 public int hashCode() { 103 return new HashCodeBuilder(17, 37).append(code).append(message).append(values).toHashCode(); 104 } 105 106}