Personally, I find the mix of []
and {}
not so easy to get an immediate view of the hierarchy.
I like this format (and I've seen it being used in a number of places):
SimpleClassName[prop1=value, prop2=value]
SimpleClassName[prop1=value, prop2=NestedObject[prop3=value]]
There's also the possibility to add an identifier with @
, for example the default style for the commons-lang ToStringBuilder
does that (using its own example):
Person@182f0db[name=John Doe,age=33,smoker=false]