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