toString() is just part of the "Canonical object" story,
where you ensure each object has a correct
  - equals()
  - hashCode()
  - toString()

implementation.

I wrote a simple doclet to generate those 3 methods; it's not very
complicated.

Though, I would prefer to see those 3 methods names next to "constructor"
and "getter/setter" when I press [Alt-Ins].
As you suggest, IDEA could update it/them, when you would add/substract
instance variables.


Alain Ravet


----- Original Message -----
From: "Jim Birchfield" <[EMAIL PROTECTED]>


> I think it would be nice to be able to generate a toString method that can
> print out all variables.  Something like this:
>
> private String name;
> private String gender;
>
> /** IDEA generated */
> public String toString() {
> StringBuffer buf = new StringBuffer();
> buf.append("name=");
> buf.append(name);
> buf.append(", gender=");
> buf.append(gender);
> return buf.toString();
> }
>
> it would be even nicer to adjust this method when ever variables are
added,
> subtracted, or changed.


_______________________________________________
Eap-features mailing list
[EMAIL PROTECTED]
http://www.intellij.com/mailman/listinfo/eap-features

Reply via email to