+1 for a straightforward implementation along the lines of this example.
It would definitely not handle all special cases "correctly" (whatever
that means) or even make everybody happy (as in "world peace" :)
but I think it would be helpful for many cases and provide a basis for
customization in special cases.
Just my EUR 0,02
- Arno
Sean Shubin schrieb:
>
> There are a lot of different ways to implement the toString() method. It
> would have to be highly customizable to keep everyone happy. Classes within
> classes could get confusing to display as well. For example:
>
> class Foo {
> int a;
> String b;
> public String toString(){
> StringBuffer ret = new StringBuffer();
> ret.append("[" + super.toString() + " ");
> ret.append("a=" + a + ",");
> ret.append("b=" + b + "]");
> return ret.toString();
> }
> }
>
> class Bar {
> double c;
> Foo d;
> public String toString(){
> StringBuffer ret = new StringBuffer();
> ret.append("[" + super.toString() + " ");
> ret.append("c=" + c + ",");
> ret.append("d=" + d + "]");
> return ret.toString();
> }
> }
>
> -----Original Message-----
> From: Berman, Andrew [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, November 27, 2001 11:14 AM
> To: [EMAIL PROTECTED]
> Subject: [Eap-features] Generate toString()
>
> Hello All,
>
> I think all of us could benefit from IntelliJ IDEA generating a
> toString(0 for us. It would be like the Getter/Setter where you could
> select the variables to be displayed and then it writes a toString for
> you using a StringBuffer. Any thoughts?
>
> --Andrew Berman
>
> _______________________________________________
> Eap-features mailing list
> [EMAIL PROTECTED]
> http://www.intellij.com/mailman/listinfo/eap-features
>
> _______________________________________________
> Eap-features mailing list
> [EMAIL PROTECTED]
> http://www.intellij.com/mailman/listinfo/eap-features
_______________________________________________
Eap-features mailing list
[EMAIL PROTECTED]
http://www.intellij.com/mailman/listinfo/eap-features