Categories
General

Eclipse equals/hashcode extension

Lately, I’ve been working on another eclipse extension. This one generates equals/hashcode methods which use the commons-lang HashcodeBuilder and EqualsBuilder (in non-reflection) mode. So, a single keypress will provide equals/hashcode methods which cover all non-static fields, plus sort out the import’s required.

After writing this, I found commons4e, which has the same aim. Actually, I still prefer my own because it’s optimized for the common case. I don’t like fluffy dialog boxes which let you choose exactly which fields to include. Just generate the code for all the fields, and use normal editing commands to get rid of the ones you don’t like.

Writing my own has helped me learn more about the eclipse api’s (and the lack of quasiquoting), and this should hopefully lead onto more complex things being possible.