1 45 package org.openejb.test.object; 46 47 52 public class Account implements java.io.Serializable { 53 54 private String ssn; 55 private String firstName; 56 private String lastName; 57 private int balance; 58 59 public Account(String ssn, String firstName, String lastName, int balance){ 60 this.ssn = ssn; 61 this.firstName = firstName.trim(); 62 this.lastName = lastName.trim(); 63 this.balance = balance; 64 } 65 66 public Account(){ 67 } 68 69 public boolean equals(Object object){ 70 if ( !(object instanceof Account ) ) return false; 71 72 Account that = (Account)object; 73 74 return (this.ssn.equals(that.ssn) && 75 this.firstName.equals(that.firstName) && 76 this.lastName.equals(that.lastName) && 77 this.balance == that.balance); 78 } 79 80 81 public String getSsn(){ 82 return ssn; 83 } 84 85 public void setSsn(String ssn){ 86 this.ssn = ssn; 87 } 88 89 public String getFirstName(){ 90 return firstName; 91 } 92 93 public void setFirstName(String firstName){ 94 this.firstName = (firstName != null)? firstName.trim():null; 95 } 96 97 public String getLastName(){ 98 return lastName; 99 } 100 public void setLastName(String lastName){ 101 this.lastName = (lastName != null)? lastName.trim():null; 102 } 103 104 public int getBalance(){ 105 return balance; 106 } 107 public void setBalance(int balance){ 108 this.balance = balance; 109 } 110 111 112 public String toString(){ 113 return "["+ssn+"]["+firstName+"]["+lastName+"]["+balance+"]"; 114 } 115 } 116 | Popular Tags |