KickJava   Java API By Example, From Geeks To Geeks.

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


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/Bank.
26  */

27 public class BankData extends java.lang.Object JavaDoc implements java.io.Serializable JavaDoc
28 {
29    /** The serialVersionUID */
30    private static final long serialVersionUID = -5127677790748691817L;
31
32    private java.lang.String JavaDoc id;
33
34    private java.lang.String JavaDoc name;
35
36    private java.lang.String JavaDoc address;
37
38    public BankData()
39    {
40    }
41
42    public BankData(java.lang.String JavaDoc id, java.lang.String JavaDoc name, java.lang.String JavaDoc address)
43    {
44       setId(id);
45       setName(name);
46       setAddress(address);
47    }
48
49    public BankData(BankData otherData)
50    {
51       setId(otherData.getId());
52       setName(otherData.getName());
53       setAddress(otherData.getAddress());
54
55    }
56
57    public org.jboss.test.banknew.interfaces.BankPK getPrimaryKey()
58    {
59       org.jboss.test.banknew.interfaces.BankPK pk = new org.jboss.test.banknew.interfaces.BankPK(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 getName()
74    {
75       return this.name;
76    }
77
78    public void setName(java.lang.String JavaDoc name)
79    {
80       this.name = name;
81    }
82
83    public java.lang.String JavaDoc getAddress()
84    {
85       return this.address;
86    }
87
88    public void setAddress(java.lang.String JavaDoc address)
89    {
90       this.address = address;
91    }
92
93    public String JavaDoc toString()
94    {
95       StringBuffer JavaDoc str = new StringBuffer JavaDoc("{");
96
97       str.append("id=" + getId() + " " + "name=" + getName() + " " + "address=" + getAddress());
98       str.append('}');
99
100       return (str.toString());
101    }
102
103    public boolean equals(Object JavaDoc pOther)
104    {
105       if (pOther instanceof BankData)
106       {
107          BankData lTest = (BankData) 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.name == null)
119          {
120             lEquals = lEquals && (lTest.name == null);
121          }
122          else
123          {
124             lEquals = lEquals && this.name.equals(lTest.name);
125          }
126          if (this.address == null)
127          {
128             lEquals = lEquals && (lTest.address == null);
129          }
130          else
131          {
132             lEquals = lEquals && this.address.equals(lTest.address);
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.name != null) ? this.name.hashCode() : 0);
150
151       result = 37 * result + ((this.address != null) ? this.address.hashCode() : 0);
152
153       return result;
154    }
155
156 }
157
Popular Tags