Later today I'll post live template for making canonical class using reflection. The code is not that simple, but it has the advantage that you don't have to modify it when new members are added.
-- dimiter "Alain Ravet" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > dimiter wrote: > > > At least for me these generated methods don't add any value. > > > Ever written this code for 5 15+ field classes, that map objects to DB > data? Pretty boring, and error prone. > > > > If I want equals I prefer to write it myself and to determine precisely > > which variables define the state of my class, > > > So do I; but I start from a complete and functionning skeleton, that I > tune if necessary. > Less error prone. Helps me be consistent, across classes. > The "template" side is an extra advantage for team consistency. > > > > if I write toString - I want > > to see concise description and not full memory dump (that's what the > > debugger is for). > > > So do I; but ... > > > > But if you feel more comfortable with standard implementations, > > > I use Joshua Bloch - "Effective Java" - /standard/. > > http://www.amazon.co.uk/exec/obidos/ASIN/0201310058/qid=1023090468/sr=2-1/re f=sr_2_3_1/026-2098539-4510843 > A good enough standard to start with. > > > > you could > > > use the generic versions and rewrite them yourself if the profiling shows > > them as bottlenecks (I've seen this very rarely). > > > Having this task automated helps a lot. > No more "do I really need to spend 5-20 minutes making this object > canonical, when all I need is a basic toString(). > > > Having this task integrated would help even more : modifiying the class > structure would trigger change/notification. It's not top priority, but > like many IDEA cool "little" features, they quickly become invaluable. > > > so from me it gets -1 > > > Does "-1" mean that > - you would write a plug-in to remove it from the standard menus, > to save space, > > or simply that you think that > - you would never use it > ? > > Alain > > ------------------------------------ > > >>Martin Bayly wrote: > >>>I find it tedious to write equals, hashcode and toString methods for > >>>classes. It would be great if IDEA could do this for me by examing > >>>the fields of a class and generating/maintaining a default > >>>implementation of these methods. > > > > Alain Ravet wrote: > >>+5 > >>This is an old request - and battle - : make objects canonical. > >>In the meantime, I solved this with a doclet. Not perfect, but good > > enough. > >>Integration would be better, though. > > _______________________________________________ Eap-features mailing list [EMAIL PROTECTED] http://lists.jetbrains.com/mailman/listinfo/eap-features
