001/* 002 * Copyright 2010-2013 Ning, Inc. 003 * 004 * Ning licenses this file to you under the Apache License, version 2.0 005 * (the "License"); you may not use this file except in compliance with the 006 * License. You may obtain a copy of the License at: 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 012 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 013 * License for the specific language governing permissions and limitations 014 * under the License. 015 */ 016 017package com.ning.billing.recurly.model; 018 019import javax.xml.bind.annotation.XmlElement; 020import javax.xml.bind.annotation.XmlRootElement; 021 022@XmlRootElement(name = "error") 023public class RecurlyError extends RecurlyObject { 024 025 @XmlElement(name = "field") 026 private String field; 027 028 @XmlElement(name = "symbol") 029 private String symbol; 030 031 @XmlElement(name = "message") 032 private String message; 033 034 public String getField() { 035 return field; 036 } 037 038 public void setField(final String field) { 039 this.field = field; 040 } 041 042 public String getSymbol() { 043 return symbol; 044 } 045 046 public void setSymbol(final String symbol) { 047 this.symbol = symbol; 048 } 049 050 public String getMessage() { 051 return message; 052 } 053 054 public void setMessage(final String message) { 055 this.message = message; 056 } 057 058 @Override 059 public String toString() { 060 final StringBuilder sb = new StringBuilder("RecurlyError{"); 061 sb.append("field='").append(field).append('\''); 062 sb.append(", symbol='").append(symbol).append('\''); 063 sb.append(", message='").append(message).append('\''); 064 sb.append('}'); 065 return sb.toString(); 066 } 067 068 @Override 069 public boolean equals(final Object o) { 070 if (this == o) { 071 return true; 072 } 073 if (o == null || getClass() != o.getClass()) { 074 return false; 075 } 076 077 final RecurlyError that = (RecurlyError) o; 078 079 if (field != null ? !field.equals(that.field) : that.field != null) { 080 return false; 081 } 082 if (message != null ? !message.equals(that.message) : that.message != null) { 083 return false; 084 } 085 if (symbol != null ? !symbol.equals(that.symbol) : that.symbol != null) { 086 return false; 087 } 088 089 return true; 090 } 091 092 @Override 093 public int hashCode() { 094 int result = field != null ? field.hashCode() : 0; 095 result = 31 * result + (symbol != null ? symbol.hashCode() : 0); 096 result = 31 * result + (message != null ? message.hashCode() : 0); 097 return result; 098 } 099}