Tuesday, June 4, 2013

Printing out all fields of an object


Often when debugging the printed Object has just the hash number (like Object@h43a356).
The following static method uses reflections to print out all fields:

org.apache.commons.lang.
builder.ToStringBuilder.reflectionToString(object, ToStringStyle.MULTI_LINE_STYLE);

No comments: