View Javadoc

1   /*
2    * Copyright 2006-2007 the original author or authors.
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  
17  package org.springframework.batch.sample.domain.trade;
18  
19  import java.math.BigDecimal;
20  
21  
22  public class CustomerDebit {
23      private String name;
24      private BigDecimal debit;
25  
26      public CustomerDebit() {
27      }
28  
29      CustomerDebit(String name, BigDecimal debit) {
30          this.name = name;
31          this.debit = debit;
32      }
33  
34      public BigDecimal getDebit() {
35          return debit;
36      }
37  
38      public void setDebit(BigDecimal debit) {
39          this.debit = debit;
40      }
41  
42      public String getName() {
43          return name;
44      }
45  
46      public void setName(String name) {
47          this.name = name;
48      }
49  
50      public String toString() {
51          return "CustomerDebit [name=" + name + ", debit=" + debit + "]";
52      }
53  
54  	@Override
55  	public int hashCode() {
56  		final int prime = 31;
57  		int result = 1;
58  		result = prime * result + ((debit == null) ? 0 : debit.hashCode());
59  		result = prime * result + ((name == null) ? 0 : name.hashCode());
60  		return result;
61  	}
62  
63  	@Override
64  	public boolean equals(Object obj) {
65  		if (this == obj)
66  			return true;
67  		if (obj == null)
68  			return false;
69  		if (getClass() != obj.getClass())
70  			return false;
71  		CustomerDebit other = (CustomerDebit) obj;
72  		if (debit == null) {
73  			if (other.debit != null)
74  				return false;
75  		}
76  		else if (!debit.equals(other.debit))
77  			return false;
78  		if (name == null) {
79  			if (other.name != null)
80  				return false;
81  		}
82  		else if (!name.equals(other.name))
83  			return false;
84  		return true;
85  	}
86      
87  }