Announcement
iPhone DZone: Fresh Links On Your iPhone by matt at Sat Jul 05 14:09:51 EDT 2008
Reading DZone on your iPhone just got a little bit easier. Visit http://dzone.com/iphone from your iPhone to try out our beta iPhone support. You can view stories, filter by tags, and login. We'd appreciate your feedback at feedback@dzone.com.
You make DZone different! Login and vote now.
By mosheco
via j2ee-now.blogspot.com
Published: Jan 22 2008 / 03:15
In many cases it's required to implement "toString to" display the DTO (Data Transfer Object) in the log file for debugging, In this case a good solution is to use generic DTO implementaion which implement "toString" and "equal" methods in a generic way.
This link contains the complete source code.
Comments
jtheory replied ago:
See org.apache.commons.lang.builder.ToStringBuilder and org.apache.commons.lang.builder.EqualsBuilder and related classes in Apache Commons lang.
Also, I know it's not quite fair to a pure content evaluation, but the poor grammar and spelling make it tough reading.
nwbrown replied ago:
The lack of indentation also hurts readability. And as far as I can tell, the equals() method isn't valid as its not necessarily transitive or symmetric, which means it might break any data structure that holds an object implementing it. Not to mention the possibility of an infinite recursion occurring in there...
Voters For This Link (6)
Voters Against This Link (11)