Java tutorial
import org.apache.commons.lang.builder.HashCodeBuilder; import org.apache.commons.lang.builder.EqualsBuilder; import java.io.Serializable; public class Main implements Serializable { private Long id; private String title; private String author; public boolean equals(Object object) { if (!(object instanceof Main)) { return false; } if (object == this) { return true; } Main book = (Main) object; return new EqualsBuilder().append(this.id, book.id).append(this.title, book.title) .append(this.author, book.author).isEquals(); // return EqualsBuilder.reflectionEquals(this, book); } }