001/*
002 * Copyright 2006-2014 the original author or authors.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *      https://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,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016
017package org.springframework.batch.sample.domain.trade;
018
019import java.math.BigDecimal;
020
021
022public class CustomerDebit {
023    private String name;
024    private BigDecimal debit;
025
026    public CustomerDebit() {
027    }
028
029    CustomerDebit(String name, BigDecimal debit) {
030        this.name = name;
031        this.debit = debit;
032    }
033
034    public BigDecimal getDebit() {
035        return debit;
036    }
037
038    public void setDebit(BigDecimal debit) {
039        this.debit = debit;
040    }
041
042    public String getName() {
043        return name;
044    }
045
046    public void setName(String name) {
047        this.name = name;
048    }
049
050    @Override
051        public String toString() {
052        return "CustomerDebit [name=" + name + ", debit=" + debit + "]";
053    }
054
055        @Override
056        public int hashCode() {
057                final int prime = 31;
058                int result = 1;
059                result = prime * result + ((debit == null) ? 0 : debit.hashCode());
060                result = prime * result + ((name == null) ? 0 : name.hashCode());
061                return result;
062        }
063
064        @Override
065        public boolean equals(Object obj) {
066                if (this == obj) {
067                        return true;
068                }
069                if (obj == null) {
070                        return false;
071                }
072                if (getClass() != obj.getClass()) {
073                        return false;
074                }
075                CustomerDebit other = (CustomerDebit) obj;
076                if (debit == null) {
077                        if (other.debit != null) {
078                                return false;
079                        }
080                }
081                else if (!debit.equals(other.debit)) {
082                        return false;
083                }
084                if (name == null) {
085                        if (other.name != null) {
086                                return false;
087                        }
088                }
089                else if (!name.equals(other.name)) {
090                        return false;
091                }
092
093                return true;
094        }
095}