Skip to content

Instantly share code, notes, and snippets.

@P7h
Last active December 10, 2015 05:38
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save P7h/4388630 to your computer and use it in GitHub Desktop.
Save P7h/4388630 to your computer and use it in GitHub Desktop.
Guava API toString() method generator for a JavaBean or POJO for IntelliJ IDEA.
/**
* Guava API toString() method generator for a JavaBean / POJO.
* @return String representation of all the attributes of the bean.
*/
public String toString() {
#set ($autoImportPackages = "com.google.common.base.Objects")
return Objects.toStringHelper(this)
#foreach ($member in $members)
.add("$member.name", $member.accessor)
#end
.toString();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment