KickJava   Java API By Example, From Geeks To Geeks.

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


1 //$Id: Person.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 Person implements Serializable JavaDoc {
10     private String JavaDoc name;
11     private Address address;
12     private Address mailingAddress;
13     
14     public Address getAddress() {
15         return address;
16     }
17     public void setAddress(Address address) {
18         this.address = address;
19     }
20     public Address getMailingAddress() {
21         return mailingAddress;
22     }
23     public void setMailingAddress(Address mailingAddress) {
24         this.mailingAddress = mailingAddress;
25     }
26     public String JavaDoc getName() {
27         return name;
28     }
29     public void setName(String JavaDoc name) {
30         this.name = name;
31     }
32
33     public boolean equals(Object JavaDoc that) {
34         if ( !(that instanceof Person) ) return false;
35         Person person = (Person) that;
36         return person.getName().equals(name);
37     }
38     
39     public int hashCode() {
40         return name.hashCode();
41     }
42 }
43
Popular Tags