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 13 public class ContactVO { 14 15 private String contactId; 17 18 private String email; 19 20 private String firstName; 21 22 private String lastName; 23 24 private String phone; 25 26 private AddressVO address; 28 29 public ContactVO() { 30 super(); 31 } 33 34 public ContactVO(AddressVO address, String email, String firstName, String lastName, String 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 contactId, AddressVO address, String email, String firstName, String lastName, String phone) { 44 super(); 45 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 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 77 public String getContactId() { 78 return contactId; 79 } 80 81 public void setContactId(String contactId) { 82 this.contactId = contactId; 83 } 84 85 public String getEmail() { 86 return email; 87 } 88 89 public void setEmail(String email) { 90 this.email = email; 91 } 92 93 public String getFirstName() { 94 return firstName; 95 } 96 97 public void setFirstName(String firstName) { 98 this.firstName = firstName; 99 } 100 101 public String getLastName() { 102 return lastName; 103 } 104 105 public void setLastName(String lastName) { 106 this.lastName = lastName; 107 } 108 109 public String getPhone() { 110 return phone; 111 } 112 113 public void setPhone(String phone) { 114 this.phone = phone; 115 } 116 117 120 public boolean equals(Object 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 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 144 public String 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 |