The template does assume that you are using the commons-lang library. Feel free to use it and pay it forward:
${:import(org.apache.commons.lang.builder.EqualsBuilder,
org.apache.commons.lang.builder.HashCodeBuilder,
org.apache.commons.lang.builder.ReflectionToStringBuilder)}
@Override
public boolean equals(Object obj) {
return EqualsBuilder.reflectionEquals(this, obj);
}
@Override
public String toString() {
return ReflectionToStringBuilder.toString(this);
}
@Override
public int hashCode() {
return HashCodeBuilder.reflectionHashCode(this);
}
Enjoy.
Nice feature, how do you configure this in eclipse?
ReplyDeleteThanks
Nice feature. How do you configure this one in eclipse?
ReplyDeleteThanks
Yeray,
ReplyDeleteThe way that you confgure templates in Eclipse is:
1. Open Eclipse preferences
2. Navigate to Java->Editor->Templates
3. Click on the new button<
4. And then take the template I wrote and put it in there.
Hope this helps....happy coding.
Carlus