1 /***
2 * Copyright 2003-2010 Terracotta, Inc.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 package net.sf.ehcache.hibernate.domain;
18
19 import java.io.Serializable;
20
21 /***
22 * PhoneNumber
23 */
24 public class PhoneNumber implements Serializable {
25 private long personId = 0;
26 private String numberType = "home";
27 private long phone = 0;
28
29 public long getPersonId() {
30 return personId;
31 }
32
33 public void setPersonId(long personId) {
34 this.personId = personId;
35 }
36
37 public String getNumberType() {
38 return numberType;
39 }
40
41 public void setNumberType(String numberType) {
42 this.numberType = numberType;
43 }
44
45 public long getPhone() {
46 return phone;
47 }
48
49 public void setPhone(long phone) {
50 this.phone = phone;
51 }
52
53 public int hashCode() {
54 final int prime = 31;
55 int result = 1;
56 result = prime * result
57 + ((numberType == null) ? 0 : numberType.hashCode());
58 result = prime * result + (int) (personId ^ (personId >>> 32));
59 result = prime * result + (int) (phone ^ (phone >>> 32));
60 return result;
61 }
62
63 public boolean equals(Object obj) {
64 if (this == obj)
65 return true;
66 if (obj == null)
67 return false;
68 if (getClass() != obj.getClass())
69 return false;
70 final PhoneNumber other = (PhoneNumber) obj;
71 if (numberType == null) {
72 if (other.numberType != null)
73 return false;
74 } else if (!numberType.equals(other.numberType))
75 return false;
76 if (personId != other.personId)
77 return false;
78 if (phone != other.phone)
79 return false;
80 return true;
81 }
82
83 public String toString() {
84 return numberType + ":" + phone;
85 }
86
87 }