commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jiří Mareš" <>
Subject [commons-lang] ToStringBuilder: Changing the collection holding the already printed objects
Date Thu, 22 Nov 2007 12:40:36 GMT

I got into problems with the ReflectionToStringBuilder and its ThreadLocal
registry for already printed objects (in the last version the same code is
in ToStringStyle, but I'm using 2.0, therefore the code is in
ReflectionToStringBuilder). As the container holding objects is used HashSet
that requires working method hashCode from the objects ... Unfortunatelly
this requirement is not acceptable for us, because the hashCode can be coded
to compute hashCode also from Hybernate not initialized objects (collections
or proxies). It is neccesary to have this implementation of hashCode and
also working toString method.

Therefore I suggest to add some kind of factory that will be responsible for
creating the ThreadLocal Set holding objects and add default implementation
that creates HashSet.

What do you think?

Jiří Mareš
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message