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 RecurlyAPIError extends RecurlyObject {
024
025    @XmlElement(name = "description")
026    private String description;
027
028    @XmlElement(name = "symbol")
029    private String symbol;
030
031    @XmlElement(name = "details")
032    private String details;
033
034    public String getDescription() {
035        return description;
036    }
037
038    public void setDescription(final String description) {
039        this.description = description;
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 getDetails() {
051        return details;
052    }
053
054    public void setDetails(final String details) {
055        this.details = details;
056    }
057
058    @Override
059    public String toString() {
060        final StringBuilder sb = new StringBuilder("RecurlyAPIError{");
061        sb.append("description='").append(description).append('\'');
062        sb.append(", symbol='").append(symbol).append('\'');
063        sb.append(", details='").append(details).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 RecurlyAPIError that = (RecurlyAPIError) o;
078
079        if (description != null ? !description.equals(that.description) : that.description != null) {
080            return false;
081        }
082        if (details != null ? !details.equals(that.details) : that.details != 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 = description != null ? description.hashCode() : 0;
095        result = 31 * result + (symbol != null ? symbol.hashCode() : 0);
096        result = 31 * result + (details != null ? details.hashCode() : 0);
097        return result;
098    }
099}