001: /*
002: * JBoss, Home of Professional Open Source.
003: * Copyright 2006, Red Hat Middleware LLC, and individual contributors
004: * as indicated by the @author tags. See the copyright.txt file in the
005: * distribution for a full listing of individual contributors.
006: *
007: * This is free software; you can redistribute it and/or modify it
008: * under the terms of the GNU Lesser General Public License as
009: * published by the Free Software Foundation; either version 2.1 of
010: * the License, or (at your option) any later version.
011: *
012: * This software is distributed in the hope that it will be useful,
013: * but WITHOUT ANY WARRANTY; without even the implied warranty of
014: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015: * Lesser General Public License for more details.
016: *
017: * You should have received a copy of the GNU Lesser General Public
018: * License along with this software; if not, write to the Free
019: * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
020: * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
021: */
022: package org.jboss.test.banknew.interfaces;
023:
024: /**
025: * Data object for bank/Bank.
026: */
027: public class BankData extends java.lang.Object implements
028: java.io.Serializable {
029: /** The serialVersionUID */
030: private static final long serialVersionUID = -5127677790748691817L;
031:
032: private java.lang.String id;
033:
034: private java.lang.String name;
035:
036: private java.lang.String address;
037:
038: public BankData() {
039: }
040:
041: public BankData(java.lang.String id, java.lang.String name,
042: java.lang.String address) {
043: setId(id);
044: setName(name);
045: setAddress(address);
046: }
047:
048: public BankData(BankData otherData) {
049: setId(otherData.getId());
050: setName(otherData.getName());
051: setAddress(otherData.getAddress());
052:
053: }
054:
055: public org.jboss.test.banknew.interfaces.BankPK getPrimaryKey() {
056: org.jboss.test.banknew.interfaces.BankPK pk = new org.jboss.test.banknew.interfaces.BankPK(
057: this .getId());
058: return pk;
059: }
060:
061: public java.lang.String getId() {
062: return this .id;
063: }
064:
065: public void setId(java.lang.String id) {
066: this .id = id;
067: }
068:
069: public java.lang.String getName() {
070: return this .name;
071: }
072:
073: public void setName(java.lang.String name) {
074: this .name = name;
075: }
076:
077: public java.lang.String getAddress() {
078: return this .address;
079: }
080:
081: public void setAddress(java.lang.String address) {
082: this .address = address;
083: }
084:
085: public String toString() {
086: StringBuffer str = new StringBuffer("{");
087:
088: str.append("id=" + getId() + " " + "name=" + getName() + " "
089: + "address=" + getAddress());
090: str.append('}');
091:
092: return (str.toString());
093: }
094:
095: public boolean equals(Object pOther) {
096: if (pOther instanceof BankData) {
097: BankData lTest = (BankData) pOther;
098: boolean lEquals = true;
099:
100: if (this .id == null) {
101: lEquals = lEquals && (lTest.id == null);
102: } else {
103: lEquals = lEquals && this .id.equals(lTest.id);
104: }
105: if (this .name == null) {
106: lEquals = lEquals && (lTest.name == null);
107: } else {
108: lEquals = lEquals && this .name.equals(lTest.name);
109: }
110: if (this .address == null) {
111: lEquals = lEquals && (lTest.address == null);
112: } else {
113: lEquals = lEquals && this .address.equals(lTest.address);
114: }
115:
116: return lEquals;
117: } else {
118: return false;
119: }
120: }
121:
122: public int hashCode() {
123: int result = 17;
124:
125: result = 37 * result
126: + ((this .id != null) ? this .id.hashCode() : 0);
127:
128: result = 37 * result
129: + ((this .name != null) ? this .name.hashCode() : 0);
130:
131: result = 37
132: * result
133: + ((this .address != null) ? this .address.hashCode() : 0);
134:
135: return result;
136: }
137:
138: }
|