This is really old news but I always forget which class to use when I need to provide a toString method that uses reflection to print out all the classes values
ToStringBuilder.reflectionToString in the apache commons library gives this functionality.
e.g.
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this);
}
We are currently starting to use Guava as a Utility library and the class Objects.ToStringHelper provides nice utilities for printing out an objects values but unfortunately doesn’t support reflection yet. The support for reflection is discussed here
Preventing Maven Plugin Mojo running multiple times for multi module projects
Spring MVC 406 status code from AJAX requests
So, what do you think ?