To implement the equals method of an object easily you could use the EqualsBuilder class.
Selecting the fields:
@Override
public boolean equals(Object obj) {
if(!(obj instanceof MyClass)) {
return false;
}
MyClass theOther = (MyClass) obj;
EqualsBuilder builde...
To implement the hashCode method of an object easily you could use the HashCodeBuilder class.
Selecting the fields:
@Override
public int hashCode() {
HashCodeBuilder builder = new HashCodeBuilder();
builder.append(field1);
builder.append(field2);
builder.append(field3);
...
To implement the toString method of an object easily you could use the ToStringBuilder class.
Selecting the fields:
@Override
public String toString() {
ToStringBuilder builder = new ToStringBuilder(this);
builder.append(field1);
builder.append(field2);
builder.append(field3...