Tuesday, September 29, 2009

Eclipse toString generator magic

In June I made some general comments about Eclipse contributions, using the poor toString generator as my target. Fundamentally I still think Cay Horstmann's arguments are valid, but also, sometimes a partially complete solution is better than no solution at all.* and I realize this is one of those times. Today I needed to generate a toString method merely for the benefit of giving a nice view while debugging my application. In such a case, the toString generator came through like a charm, generating a nice, simple, clean implementation. Neat. Thanks, Mateusz.

* Sometimes a partially complete solution is worse than no idea at all.

3 comments:

Jacek Furmankiewicz said...

You need to discover Project Lombok:
http://projectlombok.org/features/ToString.html

You will never use Eclipse's code generation features again.

konberg said...

@Jacek, no, not really. It looks clever, but is clearly limited in scope.

Cheryl said...

This is awesome!