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;
020
021public class AbstractAddOn extends RecurlyObject {
022
023    @XmlElement(name = "add_on_code")
024    protected String addOnCode;
025
026    public String getAddOnCode() {
027        return addOnCode;
028    }
029
030    public void setAddOnCode(final Object addOnCode) {
031        this.addOnCode = stringOrNull(addOnCode);
032    }
033
034    @Override
035    public String toString() {
036        final StringBuilder sb = new StringBuilder("AbstractAddOn{");
037        sb.append("addOnCode='").append(addOnCode).append('\'');
038        sb.append('}');
039        return sb.toString();
040    }
041
042    @Override
043    public boolean equals(final Object o) {
044        if (this == o) {
045            return true;
046        }
047        if (o == null || getClass() != o.getClass()) {
048            return false;
049        }
050
051        final AbstractAddOn that = (AbstractAddOn) o;
052
053        if (addOnCode != null ? !addOnCode.equals(that.addOnCode) : that.addOnCode != null) {
054            return false;
055        }
056
057        return true;
058    }
059
060    @Override
061    public int hashCode() {
062        return addOnCode != null ? addOnCode.hashCode() : 0;
063    }
064}