Пример #1
0
 @Override
 public int hashCode() {
   int result = super.hashCode();
   result = 31 * result + (firstName != null ? firstName.hashCode() : 0);
   result = 31 * result + (lastName != null ? lastName.hashCode() : 0);
   result = 31 * result + (dateOfBirth != null ? dateOfBirth.hashCode() : 0);
   result = 31 * result + (gender != null ? gender.hashCode() : 0);
   result = 31 * result + (identityCard != null ? identityCard.hashCode() : 0);
   return result;
 }
Пример #2
0
  @Override
  public boolean equals(Object o) {
    if (this == o) return true;
    if (o == null || getClass() != o.getClass()) return false;
    if (!super.equals(o)) return false;

    Person person = (Person) o;
    if (id != null && id.equals(person.id)) return true;
    if (dateOfBirth != null ? !dateOfBirth.equals(person.dateOfBirth) : person.dateOfBirth != null)
      return false;
    if (firstName != null ? !firstName.equals(person.firstName) : person.firstName != null)
      return false;
    if (gender != person.gender) return false;
    if (identityCard != null
        ? !identityCard.getPnc().equals(person.identityCard.getPnc())
        : person.identityCard != null) return false;
    if (lastName != null ? !lastName.equals(person.lastName) : person.lastName != null)
      return false;

    return true;
  }
Пример #3
0
 public void setIdentityCard(IdentityCard identityCard) {
   this.identityCard = identityCard;
   identityCard.setPerson(this);
 }