01: /*
02: * Copyright 2007 Jens Dietrich
03: * Licensed under the Apache License, Version 2.0 (the "License");
04: * you may not use this file except in compliance with the License.
05: * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
06: * Unless required by applicable law or agreed to in writing, software distributed under the
07: * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
08: * either express or implied. See the License for the specific language governing permissions
09: * and limitations under the License.
10: */
11:
12: package example.nz.org.take.compiler.example1;
13:
14: /**
15: * Bean class referenced in tests.
16: * @author <a href="http://www-ist.massey.ac.nz/JBDietrich/">Jens Dietrich</a>
17: */
18:
19: public class Customer {
20: private String name = null;
21: private int turnover = 0;
22:
23: public int getTurnover() {
24: return turnover;
25: }
26:
27: public void setTurnover(int turnover) {
28: this .turnover = turnover;
29: }
30:
31: public Customer(String name) {
32: super ();
33: this .name = name;
34: }
35:
36: public String getName() {
37: return name;
38: }
39:
40: public void setName(String name) {
41: this .name = name;
42: }
43:
44: @Override
45: public int hashCode() {
46: final int PRIME = 31;
47: int result = 1;
48: result = PRIME * result
49: + ((name == null) ? 0 : name.hashCode());
50: return result;
51: }
52:
53: @Override
54: public boolean equals(Object obj) {
55: if (this == obj)
56: return true;
57: if (obj == null)
58: return false;
59: if (getClass() != obj.getClass())
60: return false;
61: final Customer other = (Customer) obj;
62: if (name == null) {
63: if (other.name != null)
64: return false;
65: } else if (!name.equals(other.name))
66: return false;
67: return true;
68: }
69:
70: }
|