Adam Bien's Weblog

Friday Sep 11, 2009

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
    @Override
    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 :-).


[my tweets]  Rss My book: Real World Java EE - Rethinking Best Practices

Kommentare:

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:
http://plugins.netbeans.org/PluginPortal/faces/PluginDetailPage.jsp?pluginid=21008

Kind Regard,
Simon

Gesendet von Martinelli Simon am September 11, 2009 at 01:28 PM CEST #

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

http://kenai.com/projects/nbtostring/downloads

Gesendet von Simon Martinelli am September 11, 2009 at 01:32 PM CEST #

@Simon,

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

have fun!,

adam

Gesendet von Adam Bien am September 11, 2009 at 05:44 PM CEST #

Senden Sie einen Kommentar:
  • HTML Syntax: Ausgeschaltet
Meta-stuff / Interviews
My Recent Book
Java One 2009
CommunityOne East N.Y.C
JavaONE 2008 Interview
Search
...the last 150 posts
...the last 10 comments
greenfire.dev.java.net
Links
my.netbeans.org
Visitors
License