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