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/Account.
026: */
027: public class AccountData extends java.lang.Object implements
028: java.io.Serializable {
029: /** The serialVersionUID */
030: private static final long serialVersionUID = -4437159401867282063L;
031:
032: private java.lang.String id;
033:
034: private java.lang.String customerId;
035:
036: private int type;
037:
038: private float balance;
039:
040: public AccountData() {
041: }
042:
043: public AccountData(java.lang.String id,
044: java.lang.String customerId, int type, float balance) {
045: setId(id);
046: setCustomerId(customerId);
047: setType(type);
048: setBalance(balance);
049: }
050:
051: public AccountData(AccountData otherData) {
052: setId(otherData.getId());
053: setCustomerId(otherData.getCustomerId());
054: setType(otherData.getType());
055: setBalance(otherData.getBalance());
056:
057: }
058:
059: public org.jboss.test.banknew.interfaces.AccountPK getPrimaryKey() {
060: org.jboss.test.banknew.interfaces.AccountPK pk = new org.jboss.test.banknew.interfaces.AccountPK(
061: this .getId());
062: return pk;
063: }
064:
065: public java.lang.String getId() {
066: return this .id;
067: }
068:
069: public void setId(java.lang.String id) {
070: this .id = id;
071: }
072:
073: public java.lang.String getCustomerId() {
074: return this .customerId;
075: }
076:
077: public void setCustomerId(java.lang.String customerId) {
078: this .customerId = customerId;
079: }
080:
081: public int getType() {
082: return this .type;
083: }
084:
085: public void setType(int type) {
086: this .type = type;
087: }
088:
089: public float getBalance() {
090: return this .balance;
091: }
092:
093: public void setBalance(float balance) {
094: this .balance = balance;
095: }
096:
097: public String toString() {
098: StringBuffer str = new StringBuffer("{");
099:
100: str.append("id=" + getId() + " " + "customerId="
101: + getCustomerId() + " " + "type=" + getType() + " "
102: + "balance=" + getBalance());
103: str.append('}');
104:
105: return (str.toString());
106: }
107:
108: public boolean equals(Object pOther) {
109: if (pOther instanceof AccountData) {
110: AccountData lTest = (AccountData) pOther;
111: boolean lEquals = true;
112:
113: if (this .id == null) {
114: lEquals = lEquals && (lTest.id == null);
115: } else {
116: lEquals = lEquals && this .id.equals(lTest.id);
117: }
118: if (this .customerId == null) {
119: lEquals = lEquals && (lTest.customerId == null);
120: } else {
121: lEquals = lEquals
122: && this .customerId.equals(lTest.customerId);
123: }
124: lEquals = lEquals && this .type == lTest.type;
125: lEquals = lEquals && this .balance == lTest.balance;
126:
127: return lEquals;
128: } else {
129: return false;
130: }
131: }
132:
133: public int hashCode() {
134: int result = 17;
135:
136: result = 37 * result
137: + ((this .id != null) ? this .id.hashCode() : 0);
138:
139: result = 37
140: * result
141: + ((this .customerId != null) ? this .customerId
142: .hashCode() : 0);
143:
144: result = 37 * result + type;
145:
146: result = 37 * result + Float.floatToIntBits(balance);
147:
148: return result;
149: }
150:
151: }
|