KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > rentacar > persistance > bo > ContactVO


1 package org.objectweb.rentacar.persistance.bo;
2
3 import org.apache.commons.lang.builder.EqualsBuilder;
4 import org.apache.commons.lang.builder.HashCodeBuilder;
5 import org.apache.commons.lang.builder.ToStringBuilder;
6
7 /**
8  *
9  * @author ofabre
10  *
11  *
12  */

13 public class ContactVO {
14     
15     // Fields
16
private String JavaDoc contactId;
17     
18     private String JavaDoc email;
19     
20     private String JavaDoc firstName;
21     
22     private String JavaDoc lastName;
23     
24     private String JavaDoc phone;
25     
26     // Relations
27
private AddressVO address;
28
29     public ContactVO() {
30         super();
31         // TODO Auto-generated constructor stub
32
}
33     
34     public ContactVO(AddressVO address, String JavaDoc email, String JavaDoc firstName, String JavaDoc lastName, String JavaDoc phone) {
35         super();
36         this.address = address;
37         this.email = email;
38         this.firstName = firstName;
39         this.lastName = lastName;
40         this.phone = phone;
41     }
42
43     public ContactVO(String JavaDoc contactId, AddressVO address, String JavaDoc email, String JavaDoc firstName, String JavaDoc lastName, String JavaDoc phone) {
44         super();
45         // TODO Auto-generated constructor stub
46
this.contactId = contactId;
47         this.address = address;
48         this.email = email;
49         this.firstName = firstName;
50         this.lastName = lastName;
51         this.phone = phone;
52     }
53     
54     public ContactVO(Contact contact) {
55         super();
56         // TODO Auto-generated constructor stub
57
this.contactId = contact.getContactId();
58         this.address = new AddressVO(contact.getAddress());
59         this.email = contact.getEmail();
60         this.firstName = contact.getFirstName();
61         this.lastName = contact.getLastName();
62         this.phone = contact.getPhone();
63     }
64
65     public AddressVO getAddress() {
66         return address;
67     }
68
69     public void setAddress(AddressVO address) {
70         this.address = address;
71     }
72
73     /**
74      *
75      * @return
76      */

77     public String JavaDoc getContactId() {
78         return contactId;
79     }
80
81     public void setContactId(String JavaDoc contactId) {
82         this.contactId = contactId;
83     }
84
85     public String JavaDoc getEmail() {
86         return email;
87     }
88
89     public void setEmail(String JavaDoc email) {
90         this.email = email;
91     }
92
93     public String JavaDoc getFirstName() {
94         return firstName;
95     }
96
97     public void setFirstName(String JavaDoc firstName) {
98         this.firstName = firstName;
99     }
100
101     public String JavaDoc getLastName() {
102         return lastName;
103     }
104
105     public void setLastName(String JavaDoc lastName) {
106         this.lastName = lastName;
107     }
108
109     public String JavaDoc getPhone() {
110         return phone;
111     }
112
113     public void setPhone(String JavaDoc phone) {
114         this.phone = phone;
115     }
116
117     /**
118      * @see java.lang.Object#equals(Object)
119      */

120     public boolean equals(Object JavaDoc object) {
121         if (!(object instanceof ContactVO)) {
122             return false;
123         }
124         ContactVO rhs = (ContactVO) object;
125         return new EqualsBuilder().append(this.phone, rhs.phone).append(
126                 this.address, rhs.address).append(this.email, rhs.email)
127                 .append(this.contactId, rhs.contactId).append(this.firstName,
128                         rhs.firstName).append(this.lastName, rhs.lastName)
129                 .isEquals();
130     }
131
132     /**
133      * @see java.lang.Object#hashCode()
134      */

135     public int hashCode() {
136         return new HashCodeBuilder(-684648355, 551342479).append(this.phone)
137                 .append(this.address).append(this.email).append(this.contactId)
138                 .append(this.firstName).append(this.lastName).toHashCode();
139     }
140
141     /**
142      * @see java.lang.Object#toString()
143      */

144     public String JavaDoc toString() {
145         return new ToStringBuilder(this).append("phone", this.phone).append(
146                 "lastName", this.lastName).append("email", this.email).append(
147                 "contactId", this.contactId).append("address", this.address)
148                 .append("firstName", this.firstName).toString();
149     }
150     
151     
152
153 }
154
Popular Tags