[ANN] - Generate toString v3.17 released

GenerateToString is a action plugin for IDEA that is used to create or update java classes toString() method. The reason is valuebeans usually needs to dump their fieldvalues for debug purpose, and it's tedious to write the dump code for this. So this action plugin generates the code to dump all the fields in a simple manner.


v3.17 for IDEA 5.0x (aug-11-2005)
=================================
- Compiled with jdk-1.4.2_05 using IDEA 5.0 final #3436
- Option to move caret to toString method after code generation
- Option to exclude enum fields available to code generation
- Options to exclude exception, deprecated, abstract or enum classes in inspection for 'Class does not overwrite toString() method'
- $class.isException, $class.isEnum, $class.isDeprecated, $class.isAbstract, $method.isDeprecated, $field.isEnum added to Velocity Context
- fixed inserted position of toString() method for classes declaring enums (JDK1.5)

5 comments
Comment actions Permalink

Why doesn't it insert the toString() method at the cursor?

Claus Ibsen schrieb:

GenerateToString is a action plugin for IDEA that is used to create or update java classes toString() method. The reason is valuebeans usually needs to dump their fieldvalues for debug purpose, and it's tedious to write the dump code for this. So this action plugin generates the code to dump all the fields in a simple manner.


v3.17 for IDEA 5.0x (aug-11-2005)
=================================
- Compiled with jdk-1.4.2_05 using IDEA 5.0 final #3436
- Option to move caret to toString method after code generation
- Option to exclude enum fields available to code generation
- Options to exclude exception, deprecated, abstract or enum classes in inspection for 'Class does not overwrite toString() method'
- $class.isException, $class.isEnum, $class.isDeprecated, $class.isAbstract, $method.isDeprecated, $field.isEnum added to Velocity Context
- fixed inserted position of toString() method for classes declaring enums (JDK1.5)

0
Comment actions Permalink

Insert at cursor?

I think most people want a toString() method to be placed last in a class. It's rarely seen placed elsewhere.

Bt yes I would add an option to insert it a current cursor line just like the get/set generators.

Thanks for the idea.

0
Comment actions Permalink

Claus

>>Insert at cursor?
>>
>>
>I think most people want a toString() method to be placed last in a class. It's rarely seen placed elsewhere.
>

>
...
equals(.)
hashCode()
toString()
...

I always place toString after equals() and hashCode(). They form the
'canonical trio', and the Rearranger plugin moves them as a group.


I also put the 3 methods opening brace on the top line, and remove the
space between the methods => when I fold them, they just take 3 lines.

Alain

0
Comment actions Permalink

That is really a good reason to use the rearranger plugin.

0
Comment actions Permalink

Claus Ibsen wrote:

That is really a good reason to use the rearranger plugin.


Maybe generate tostring should honor the rearranger plugin configuration, if it exists.

0

Please sign in to leave a comment.