Re: Data::Dumper for java
horos11@gmail.com wrote:
Perl has a very nice class called Data::Dumper which recursively
prints out data structures and objects, such that if an object owns
other objects, those too are printed out in 'standardized' form (ie:
showing all public and private fields of those subobjects).
Is there an equivalent module in java?
I know you could make one using reflection; my question is *has*
someone made one, one that is tunable (ie: that can override objects'
toString() methods, shows only so many levels of output, etc. Being
able to override toString() for subobjects is very important because
Java so helpfully provides a somewhat meaningless toString() function
for Object)
I'm unfamiliar with Perl and it's libraries, so I have to ask -- what
would you do with such a thing?
For debugging, my debugger shows me all I need, with out any work
whatsoever on my part. I haven't looked into logging utilities but the
default ones do take an object as a parameter. This might just invoke
toString() however. Then there's Serialization and XMLEncoder/Decoder,
which might be consdiered "stadardized" forms also.
For documentation, there's this thing called Javadoc. Try it, you might
like it.