1 7 package org.jboss.cache.marshall.data; 8 9 import java.io.Serializable ; 10 11 12 14 public class Person implements Serializable 15 { 16 String name = null; 17 Address address; 18 19 public Person() 20 { 21 } 22 23 public String getName() 24 { 25 return name; 26 } 27 28 public void setName(String name) 29 { 30 this.name = name; 31 } 32 33 public void setName(Object obj) 34 { 35 this.name = (String ) obj; 36 } 37 38 public Address getAddress() 39 { 40 return address; 41 } 42 43 public void setAddress(Address address) 44 { 45 this.address = address; 46 } 47 48 public String toString() 49 { 50 StringBuffer sb = new StringBuffer (); 51 sb.append("name=").append(getName()).append(" Address= ").append(address); 52 return sb.toString(); 53 } 54 55 public boolean equals(Object o) 56 { 57 if (this == o) return true; 58 if (o == null || getClass() != o.getClass()) return false; 59 60 final Person person = (Person) o; 61 62 if (address != null ? !address.equals(person.address) : person.address != null) return false; 63 if (name != null ? !name.equals(person.name) : person.name != null) return false; 64 65 return true; 66 } 67 68 public int hashCode() 69 { 70 int result; 71 result = (name != null ? name.hashCode() : 0); 72 result = 29 * result + (address != null ? address.hashCode() : 0); 73 return result; 74 } 75 76 } 77 | Popular Tags |