KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > test > banknew > interfaces > CustomerData


1 /*
2  * JBoss, Home of Professional Open Source
3  * Copyright 2006, JBoss Inc., and individual contributors as indicated
4  * by the @authors tag. See the copyright.txt in the distribution for a
5  * full listing of individual contributors.
6  *
7  * This is free software; you can redistribute it and/or modify it
8  * under the terms of the GNU Lesser General Public License as
9  * published by the Free Software Foundation; either version 2.1 of
10  * the License, or (at your option) any later version.
11  *
12  * This software is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this software; if not, write to the Free
19  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21  */

22 package org.jboss.test.banknew.interfaces;
23
24 /**
25  * Data object for bank/Customer.
26  */

27 public class CustomerData extends java.lang.Object JavaDoc implements java.io.Serializable JavaDoc
28 {
29    /** The serialVersionUID */
30    private static final long serialVersionUID = 713727152767197901L;
31
32    private java.lang.String JavaDoc id;
33
34    private java.lang.String JavaDoc bankId;
35
36    private java.lang.String JavaDoc name;
37
38    public CustomerData()
39    {
40    }
41
42    public CustomerData(java.lang.String JavaDoc id, java.lang.String JavaDoc bankId, java.lang.String JavaDoc name)
43    {
44       setId(id);
45       setBankId(bankId);
46       setName(name);
47    }
48
49    public CustomerData(CustomerData otherData)
50    {
51       setId(otherData.getId());
52       setBankId(otherData.getBankId());
53       setName(otherData.getName());
54
55    }
56
57    public org.jboss.test.banknew.interfaces.CustomerPK getPrimaryKey()
58    {
59       org.jboss.test.banknew.interfaces.CustomerPK pk = new org.jboss.test.banknew.interfaces.CustomerPK(this.getId());
60       return pk;
61    }
62
63    public java.lang.String JavaDoc getId()
64    {
65       return this.id;
66    }
67
68    public void setId(java.lang.String JavaDoc id)
69    {
70       this.id = id;
71    }
72
73    public java.lang.String JavaDoc getBankId()
74    {
75       return this.bankId;
76    }
77
78    public void setBankId(java.lang.String JavaDoc bankId)
79    {
80       this.bankId = bankId;
81    }
82
83    public java.lang.String JavaDoc getName()
84    {
85       return this.name;
86    }
87
88    public void setName(java.lang.String JavaDoc name)
89    {
90       this.name = name;
91    }
92
93    public String JavaDoc toString()
94    {
95       StringBuffer JavaDoc str = new StringBuffer JavaDoc("{");
96
97       str.append("id=" + getId() + " " + "bankId=" + getBankId() + " " + "name=" + getName());
98       str.append('}');
99
100       return (str.toString());
101    }
102
103    public boolean equals(Object JavaDoc pOther)
104    {
105       if (pOther instanceof CustomerData)
106       {
107          CustomerData lTest = (CustomerData) pOther;
108          boolean lEquals = true;
109
110          if (this.id == null)
111          {
112             lEquals = lEquals && (lTest.id == null);
113          }
114          else
115          {
116             lEquals = lEquals && this.id.equals(lTest.id);
117          }
118          if (this.bankId == null)
119          {
120             lEquals = lEquals && (lTest.bankId == null);
121          }
122          else
123          {
124             lEquals = lEquals && this.bankId.equals(lTest.bankId);
125          }
126          if (this.name == null)
127          {
128             lEquals = lEquals && (lTest.name == null);
129          }
130          else
131          {
132             lEquals = lEquals && this.name.equals(lTest.name);
133          }
134
135          return lEquals;
136       }
137       else
138       {
139          return false;
140       }
141    }
142
143    public int hashCode()
144    {
145       int result = 17;
146
147       result = 37 * result + ((this.id != null) ? this.id.hashCode() : 0);
148
149       result = 37 * result + ((this.bankId != null) ? this.bankId.hashCode() : 0);
150
151       result = 37 * result + ((this.name != null) ? this.name.hashCode() : 0);
152
153       return result;
154    }
155
156 }
157
Popular Tags