Exemple #1
0
 @Override
 public boolean equals(Object obj) {
   if (this == obj) return true;
   if (obj == null) return false;
   if (getClass() != obj.getClass()) return false;
   Cliente other = (Cliente) obj;
   if (cnpj == null) {
     if (other.cnpj != null) return false;
   } else if (!cnpj.equals(other.cnpj)) return false;
   if (cpf == null) {
     if (other.cpf != null) return false;
   } else if (!cpf.equals(other.cpf)) return false;
   if (email == null) {
     if (other.email != null) return false;
   } else if (!email.equals(other.email)) return false;
   if (endereco == null) {
     if (other.endereco != null) return false;
   } else if (!endereco.equals(other.endereco)) return false;
   if (id == null) {
     if (other.id != null) return false;
   } else if (!id.equals(other.id)) return false;
   if (nome == null) {
     if (other.nome != null) return false;
   } else if (!nome.equals(other.nome)) return false;
   if (telefones == null) {
     if (other.telefones != null) return false;
   } else if (!telefones.equals(other.telefones)) return false;
   return true;
 }
Exemple #2
0
 @Override
 public int hashCode() {
   final int prime = 31;
   int result = 1;
   result = prime * result + ((cnpj == null) ? 0 : cnpj.hashCode());
   result = prime * result + ((cpf == null) ? 0 : cpf.hashCode());
   result = prime * result + ((email == null) ? 0 : email.hashCode());
   result = prime * result + ((endereco == null) ? 0 : endereco.hashCode());
   result = prime * result + ((id == null) ? 0 : id.hashCode());
   result = prime * result + ((nome == null) ? 0 : nome.hashCode());
   result = prime * result + ((telefones == null) ? 0 : telefones.hashCode());
   return result;
 }