Hi all,

To create a deep toString() representation of an object, one must use a 
combination of ReflectionToStringBuilder and RecursiveToStringStyle. IMO this 
confuses behaviour and presentation. LANG-1249 is an example of the problems 
the original design can cause - it’s not clear from the 
ReflectionToStringBuilder documentation whether RecursiveToStringStyle is able 
or willing to take notice of the excluded fields for inner objects.

I propose that the recursion behaviour is governed by the builder, not the 
ToStringStyle. Either a new class should be created (RecursiveToStringBuilder) 
or additional constructors should be added to ReflectionToStringBuilder to 
trigger recursion.

This would have the added benefit of allowing different styling options when 
recursion is employed. I’m a little concerned whether MULTI_LINE_STYLE would 
work correctly without an overhaul of the ToStringStyle class to include some 
kind of “depth” indicator. But I can dig into that further if there’s any 
interest in this idea.

What do people think about this? I tried to search the mail archives for some 
discussion around these classes, but couldn’t find anything. Apologies if this 
is well trodden ground.

Duncan 
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org

Reply via email to