Do we need HyperJAXB generated hashCode & equals methods?
- by Marcus
We've generated some (well a lot) of classes using HyperJAXB. All of the classes implement Equals and HashCode and have the implementation style below. Appears this code is never executed.. is there any particular reason we need this code? I'm looking to simplify the classes if we can.
public boolean equals(Object object) {
if (!(object instanceof MyClass)) {
return false;
}
if (this == object) {
return true;
}
final EqualsBuilder equalsBuilder = new JAXBEqualsBuilder();
equals(object, equalsBuilder);
return equalsBuilder.isEquals();
}
public void hashCode(HashCodeBuilder hashCodeBuilder) {
hashCodeBuilder.append(this.getValue());
hashCodeBuilder.append(this.getId());
}
public int hashCode() {
final HashCodeBuilder hashCodeBuilder = new JAXBHashCodeBuilder();
hashCode(hashCodeBuilder);
return hashCodeBuilder.toHashCode();
}