com.darwinsys.calendar.Person Maven / Gradle / Ivy
package com.darwinsys.calendar;
import java.io.Serializable;
public class Person implements Serializable {
String firstName;
String lastName;
String email;
String officePhone;
String cellPhone;
public String getCellPhone() {
return cellPhone;
}
public void setCellPhone(String cellPhone) {
this.cellPhone = cellPhone;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
/** synthetic field, made from firstname and lastname
* @return The printable form of the name
*/
public String getFullName() {
return firstName + " " + lastName;
}
public String getOfficePhone() {
return officePhone;
}
public void setOfficePhone(String officePhone) {
this.officePhone = officePhone;
}
@Override
public int hashCode() {
final int PRIME = 31;
int result = 1;
result = PRIME * result + ((cellPhone == null) ? 0 : cellPhone.hashCode());
result = PRIME * result + ((email == null) ? 0 : email.hashCode());
result = PRIME * result + ((firstName == null) ? 0 : firstName.hashCode());
result = PRIME * result + ((lastName == null) ? 0 : lastName.hashCode());
result = PRIME * result + ((officePhone == null) ? 0 : officePhone.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
final Person other = (Person) obj;
if (cellPhone == null) {
if (other.cellPhone != null)
return false;
} else if (!cellPhone.equals(other.cellPhone))
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 (lastName == null) {
if (other.lastName != null)
return false;
} else if (!lastName.equals(other.lastName))
return false;
if (officePhone == null) {
if (other.officePhone != null)
return false;
} else if (!officePhone.equals(other.officePhone))
return false;
return true;
}
}