01: /*
02: * All content copyright (c) 2003-2007 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
03: */
04:
05: package com.tctest.domain;
06:
07: import java.io.Serializable;
08:
09: /**
10: * PhoneNumber
11: */
12: public class PhoneNumber implements Serializable {
13: private long personId = 0;
14: private String numberType = "home";
15: private long phone = 0;
16:
17: public long getPersonId() {
18: return personId;
19: }
20:
21: public void setPersonId(long personId) {
22: this .personId = personId;
23: }
24:
25: public String getNumberType() {
26: return numberType;
27: }
28:
29: public void setNumberType(String numberType) {
30: this .numberType = numberType;
31: }
32:
33: public long getPhone() {
34: return phone;
35: }
36:
37: public void setPhone(long phone) {
38: this .phone = phone;
39: }
40:
41: public int hashCode() {
42: final int prime = 31;
43: int result = 1;
44: result = prime * result
45: + ((numberType == null) ? 0 : numberType.hashCode());
46: result = prime * result + (int) (personId ^ (personId >>> 32));
47: result = prime * result + (int) (phone ^ (phone >>> 32));
48: return result;
49: }
50:
51: public boolean equals(Object obj) {
52: if (this == obj)
53: return true;
54: if (obj == null)
55: return false;
56: if (getClass() != obj.getClass())
57: return false;
58: final PhoneNumber other = (PhoneNumber) obj;
59: if (numberType == null) {
60: if (other.numberType != null)
61: return false;
62: } else if (!numberType.equals(other.numberType))
63: return false;
64: if (personId != other.personId)
65: return false;
66: if (phone != other.phone)
67: return false;
68: return true;
69: }
70:
71: public String toString() {
72: return numberType + ":" + phone;
73: }
74:
75: }
|