KickJava   Java API By Example, From Geeks To Geeks.

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


1 //$Id: Person.java,v 1.1 2004/09/26 00:39:43 oneovthafew Exp $
2
package org.hibernate.test.cuk;
3
4 import java.io.Serializable JavaDoc;
5 import java.util.HashSet JavaDoc;
6 import java.util.Set JavaDoc;
7
8 /**
9  * @author gavin
10  */

11 public class Person implements Serializable JavaDoc {
12     private Long JavaDoc id;
13     private String JavaDoc name;
14     private Address address;
15     private String JavaDoc userId;
16     private boolean deleted;
17     private Set JavaDoc accounts = new HashSet JavaDoc();
18     /**
19      * @return Returns the userId.
20      */

21     public String JavaDoc getUserId() {
22         return userId;
23     }
24     /**
25      * @param userId The userId to set.
26      */

27     public void setUserId(String JavaDoc userId) {
28         this.userId = userId;
29     }
30     /**
31      * @return Returns the address.
32      */

33     public Address getAddress() {
34         return address;
35     }
36     /**
37      * @param address The address to set.
38      */

39     public void setAddress(Address address) {
40         this.address = address;
41     }
42     /**
43      * @return Returns the id.
44      */

45     public Long JavaDoc getId() {
46         return id;
47     }
48     /**
49      * @param id The id to set.
50      */

51     public void setId(Long JavaDoc id) {
52         this.id = id;
53     }
54     /**
55      * @return Returns the name.
56      */

57     public String JavaDoc getName() {
58         return name;
59     }
60     /**
61      * @param name The name to set.
62      */

63     public void setName(String JavaDoc name) {
64         this.name = name;
65     }
66     /**
67      * @return Returns the accounts.
68      */

69     public Set JavaDoc getAccounts() {
70         return accounts;
71     }
72     /**
73      * @param accounts The accounts to set.
74      */

75     public void setAccounts(Set JavaDoc accounts) {
76         this.accounts = accounts;
77     }
78     
79     public boolean isDeleted() {
80         return deleted;
81     }
82     
83     public void setDeleted(boolean deleted) {
84         this.deleted = deleted;
85     }
86     
87     public boolean equals(Object JavaDoc other) {
88         if (other instanceof Person) {
89             Person that = (Person) other;
90             return that.isDeleted() == deleted && that.getUserId().equals(userId);
91         }
92         else {
93             return false;
94         }
95     }
96     
97     public int hashCode() {
98         return userId.hashCode();
99     }
100 }
101
Popular Tags