NetBeans Got An Excellent toString Generator

NetBeans 6.8 doesn't come with a toString generator out of the box. The toString generator solved the problem very well. The generator is available from the alt+insert (ctrl+i) pop-up - and so very convenient to use. You can choose between String and StringBuilder based generation. It works as expected: 

public class ToStringTest {

    private String name;
    private int age;
    private Boolean flag;
    private String descripton;

   //was generated
    public String toString() {
        return "ToStringTest [" + "age " + age + " " + "descripton " + descripton + " " + "flag " + flag + " " + "name " + name + "]";


One problem - I didn't found any reference to a NBM file and had to build it manually. It is very easy, but it takes few minutes and is inconvenient. I'm sure, that Simon is already working on a CI solution :-).

Cloudy Jakarta EE and MicroProfile: Microservices, Clouds and Beyond Jakarta EE / MicroProfile airhacks workshops at MUC airport, Winter Edition the podcast:

Stay in touch:


Hi Adam,

Nice to see that it does what you expect. We are still working on some features and will have an ever better version soon.

The download of the toString() generator can be found in NetBeans Plugin Portal:

Kind Regard,

Posted by Martinelli Simon on September 11, 2009 at 03:28 PM CEST #

And now there is also a download section on kenai project ;-)

Posted by Simon Martinelli on September 11, 2009 at 03:32 PM CEST #


some pressure seems to help :-). I looked at the code - its nicely done, although the parsing API is bit complex.

have fun!,


Posted by Adam Bien on September 11, 2009 at 07:44 PM CEST #

There is already a toString in Netbeans....
Just Press alt + insert then choose toString!

Posted by Moessi on March 11, 2011 at 04:33 PM CET #

Post a Comment:
  • HTML Syntax: NOT allowed
Online Workshops
...the last 150 posts
...the last 10 comments