Skip to content

Instantly share code, notes, and snippets.

@jeremie-lesage
Created March 9, 2012 10:05
Show Gist options
  • Save jeremie-lesage/2005925 to your computer and use it in GitHub Desktop.
Save jeremie-lesage/2005925 to your computer and use it in GitHub Desktop.
Easy Java Bean toString() using BeanUtils
/** http://www.benmccann.com/dev-blog/easy-java-bean-tostring-using-beanutils/ **/
public String toString() {
try {
return BeanUtils.describe(this).toString();
} catch (Exception e) {
Logger.getLogger(this.getClass()).error("Error converting object to String", e);
}
return super.toString();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment