hashCode equals toString - apache builder

@Override
   public int hashCode()
   {
      return new HashCodeBuilder()
         .append(this.id)
         .append(this.name)
         .toHashCode();
   }
 
 @Override
   public boolean equals(Object obj)
   {
      if (obj instanceof SimpleDataExample == false)
      {
        return false;
      }
      if (this == obj)
      {
         return true;
      }
      final SimpleDataExample otherObject = (SimpleDataExample) obj;

      return new EqualsBuilder()
         .append(this.id, otherObject.id)
         .append(this.name, otherObject.name)
         .isEquals();
 
@Override
   public String toString()
   {
      return new ToStringBuilder(this)
         .append("ID", this.id)
         .append("Name", this.name)
         .toString();
   } 

0 comments: