I would also like IDEA to be able to provide simple default implementations of toString(), equals() and hashCode().
It would be nice if this would be integrated into the feature for inserting getters, setters and constructors. To make everybody happy, this facility needs to be expanded to provide configurable templates for these methods, as well as for getters and setters (so I can finally have the "this." in getters), maybe even for constructors. Not sure how these templates would look like though, since at least some of the tasks require some kind of looping. My 2 cents. -Thomas > -----Original Message----- > From: Alain RAVET [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, November 28, 2001 1:53 AM > To: [EMAIL PROTECTED] > Subject: [Eap-features] Conclusion : Generate toString(), ... > > > This subject keeps coming back again and again. > Please let agree, once and for all, that > > we would all benefit from a decent, non-trivial, > default implementation of > toString () > equals() > hashCode() > > > Example : > --------- > Yesterday, I had to create 4 persistence linked classes, > with 20 fields each. > > 4 times, I had to create, no-brain required, > - a no-arg constructor > - a 20-field constructor > - 20 setters > - 20 getters > > but also, I had to overide and create (very few brain-required) > - a 20 field toString () > - a 20 field equals () > - a 20 field hashCode () > > > > IDEA has a smart default behaviour for only the first 4 tasks, > but I cannot see how / why overriding > toString () > > by (your choice may vary) > > public String toString () { > return "[MyClass: " + field1 + ", " + ..... +]" > } > > is so different from implementing constructor the way we do now. > > > > > The same is valid for > equals () > hashCode () > > > > If you want a simple and "standard" recipe, > look in "Effective Java", > p 33 : equals () > p 38 : hashCode () > > > I wouldn't say no to a smart default for > compareTo() > either. > > > Alain Ravet > > This mail has been checked by exiscan. > To be safe, please scan the mail attachements with your local > virus scanner ! > > _______________________________________________ > Eap-features mailing list > [EMAIL PROTECTED] > http://www.intellij.com/mailman/listinfo/eap-features > ************************************ If this email is not intended for you, or you are not responsible for the delivery of this message to the addressee, please note that this message may contain ITT Privileged/Proprietary Information. In such a case, you may not copy or deliver this message to anyone. You should destroy this message and kindly notify the sender by reply email. Information contained in this message that does not relate to the business of ITT is neither endorsed by nor attributable to ITT. ************************************ _______________________________________________ Eap-features mailing list [EMAIL PROTECTED] http://www.intellij.com/mailman/listinfo/eap-features
