/******************************************************************************* * Copyright (c) 2011 Softberries Krzysztof Grajek. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * Softberries Krzysztof Grajek - initial API and implementation ******************************************************************************/ package com.softberries.klerk.dao.to; import java.io.Serializable; import java.util.List; public class Person implements Serializable{ private Long id; private String firstName = ""; private String lastName = ""; private List<Address> addresses; private String telephone = ""; private String mobile = ""; private String email = ""; private String www = ""; private String fullName = ""; public Long getId() { return id; } public void setId(Long id) { this.id = id; } /** * @return the addresses */ public List<Address> getAddresses() { return addresses; } /** * @param addresses the addresses to set */ public void setAddresses(List<Address> addresses) { this.addresses = addresses; } /** * @return the firstName */ public String getFirstName() { return firstName; } /** * @param firstName the firstName to set */ public void setFirstName(String firstName) { this.firstName = firstName; } /** * @return the lastName */ public String getLastName() { return lastName; } /** * @param lastName the lastName to set */ public void setLastName(String lastName) { this.lastName = lastName; } /** * @return the telephone */ public String getTelephone() { return telephone; } /** * @param telephone the telephone to set */ public void setTelephone(String telephone) { this.telephone = telephone; } /** * @return the mobile */ public String getMobile() { return mobile; } /** * @param mobile the mobile to set */ public void setMobile(String mobile) { this.mobile = mobile; } /** * @return the email */ public String getEmail() { return email; } /** * @param email the email to set */ public void setEmail(String email) { this.email = email; } /** * @return the www */ public String getWww() { return www; } /** * @param www the www to set */ public void setWww(String www) { this.www = www; } /** * Utility method to return full name of this {@code Person} * @return */ public String getFullName() { return this.getFirstName() + " " + this.getLastName(); } public void setFullName(String fullName) { this.fullName = fullName; } /* (non-Javadoc) * @see java.lang.Object#hashCode() */ @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((addresses == null) ? 0 : addresses.hashCode()); result = prime * result + ((email == null) ? 0 : email.hashCode()); result = prime * result + ((firstName == null) ? 0 : firstName.hashCode()); result = prime * result + ((fullName == null) ? 0 : fullName.hashCode()); result = prime * result + ((id == null) ? 0 : id.hashCode()); result = prime * result + ((lastName == null) ? 0 : lastName.hashCode()); result = prime * result + ((mobile == null) ? 0 : mobile.hashCode()); result = prime * result + ((telephone == null) ? 0 : telephone.hashCode()); result = prime * result + ((www == null) ? 0 : www.hashCode()); return result; } /* (non-Javadoc) * @see java.lang.Object#equals(java.lang.Object) */ @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Person other = (Person) obj; if (addresses == null) { if (other.addresses != null) return false; } else if (!addresses.equals(other.addresses)) return false; if (email == null) { if (other.email != null) return false; } else if (!email.equals(other.email)) return false; if (firstName == null) { if (other.firstName != null) return false; } else if (!firstName.equals(other.firstName)) return false; if (fullName == null) { if (other.fullName != null) return false; } else if (!fullName.equals(other.fullName)) return false; if (id == null) { if (other.id != null) return false; } else if (!id.equals(other.id)) return false; if (lastName == null) { if (other.lastName != null) return false; } else if (!lastName.equals(other.lastName)) return false; if (mobile == null) { if (other.mobile != null) return false; } else if (!mobile.equals(other.mobile)) return false; if (telephone == null) { if (other.telephone != null) return false; } else if (!telephone.equals(other.telephone)) return false; if (www == null) { if (other.www != null) return false; } else if (!www.equals(other.www)) return false; return true; } }