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