>Do you really like coding equals() by hand, for a "simple" class with 3
>booleans, 3 ints, 3 Strings, 3 arrays of String, ..
Strange, I never needed this (or only in one class out of thousand).
Tom
At 10:47 21.02.02 +0100, you wrote:
>"Thomas Singer" wrote :
> > For me a toString() method would be enough -- simply for debugging
>purposes.
>
>I'm not bringing back the "All objects should be canonical" thread/war,
>but if
> equals() is not the same as ==
>in a user-defined class,
>equals() should be overwriten or throw an "Not Yet Implemented" exception.
>Same for hashCode().
>
>Do you really like coding equals() by hand, for a "simple" class with 3
>booleans, 3 ints, 3 Strings, 3 arrays of String, ..
>It's a simple - automatizable - recipe.
>A patient and well trained monkey could do it.
>Or a doclet.
>Or IDEA
>
>
>
> > At 08:58 21.02.02 +0100, you wrote:
> > >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
_______________________________________________
Eap-features mailing list
[EMAIL PROTECTED]
http://www.intellij.com/mailman/listinfo/eap-features