1 7 package org.jboss.cache.marshall.data; 8 9 import java.io.Serializable ; 10 11 12 14 public class Address implements Serializable 15 { 16 String street = null; 17 String city = "San Jose"; 18 int zip = 0; 19 20 public Address() 21 { 22 23 } 24 25 public String getStreet() 26 { 27 return street; 28 } 29 30 public void setStreet(String street) 31 { 32 this.street = street; 33 } 34 35 public String getCity() 36 { 37 return city; 39 } 40 41 public void setCity(String city) 42 { 43 this.city = city; 45 } 46 47 public int getZip() 48 { 49 return zip; 50 } 51 52 public void setZip(int zip) 53 { 54 this.zip = zip; 55 } 56 57 public String toString() 58 { 59 return "street=" + getStreet() + ", city=" + getCity() + ", zip=" + getZip(); 60 } 61 62 66 public boolean equals(Object o) 67 { 68 if (this == o) return true; 69 if (o == null || getClass() != o.getClass()) return false; 70 71 final Address address = (Address) o; 72 73 if (zip != address.zip) return false; 74 if (city != null ? !city.equals(address.city) : address.city != null) return false; 75 if (street != null ? !street.equals(address.street) : address.street != null) return false; 76 77 return true; 78 } 79 80 public int hashCode() 81 { 82 int result; 83 result = (street != null ? street.hashCode() : 0); 84 result = 29 * result + (city != null ? city.hashCode() : 0); 85 result = 29 * result + zip; 86 return result; 87 } 88 } 89 | Popular Tags |