use google guava for hasCode, toString and equals method of person object

This commit is contained in:
Sebastian Sdorra
2012-02-26 19:42:14 +01:00
parent 4ef02e8600
commit 37c87a2c5d

View File

@@ -35,6 +35,8 @@ package sonia.scm.repository;
//~--- non-JDK imports --------------------------------------------------------
import com.google.common.base.Objects;
import sonia.scm.Validateable;
import sonia.scm.util.Util;
import sonia.scm.util.ValidationUtil;
@@ -128,6 +130,42 @@ public class Person implements Validateable, Serializable
return person;
}
/**
* {@inheritDoc}
*
* @param obj
*
* @return
*/
@Override
public boolean equals(Object obj)
{
if (obj == null)
{
return false;
}
if (getClass() != obj.getClass())
{
return false;
}
Person other = (Person) obj;
return Objects.equal(name, other.name) && Objects.equal(mail, other.mail);
}
/**
* {@inheritDoc}
*
* @return
*/
@Override
public int hashCode()
{
return Objects.hashCode(name, mail);
}
/**
* Returns a string representation of the {@link Person} object,
* in the format "name >mail<".