KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > hibernate > test > onetooneformula > Address


1 //$Id: Address.java,v 1.2 2005/02/12 07:27:29 steveebersole Exp $
2
package org.hibernate.test.onetooneformula;
3
4 import java.io.Serializable JavaDoc;
5
6 /**
7  * @author Gavin King
8  */

9 public class Address implements Serializable JavaDoc {
10     private Person person;
11     private String JavaDoc type;
12     private String JavaDoc street;
13     private String JavaDoc state;
14     private String JavaDoc zip;
15     
16     public Person getPerson() {
17         return person;
18     }
19     public void setPerson(Person person) {
20         this.person = person;
21     }
22     public String JavaDoc getState() {
23         return state;
24     }
25     public void setState(String JavaDoc state) {
26         this.state = state;
27     }
28     public String JavaDoc getStreet() {
29         return street;
30     }
31     public void setStreet(String JavaDoc street) {
32         this.street = street;
33     }
34     public String JavaDoc getType() {
35         return type;
36     }
37     public void setType(String JavaDoc type) {
38         this.type = type;
39     }
40     public String JavaDoc getZip() {
41         return zip;
42     }
43     public void setZip(String JavaDoc zip) {
44         this.zip = zip;
45     }
46     
47     public boolean equals(Object JavaDoc that) {
48         if ( !(that instanceof Address) ) return false;
49         Address address = (Address) that;
50         return address.getType().equals(type) &&
51             address.getPerson().getName().equals( person.getName() );
52     }
53     
54     public int hashCode() {
55         return person.getName().hashCode() + type.hashCode();
56     }
57 }
58
Popular Tags