Last active
April 28, 2016 13:53
-
-
Save smilix/9441452fc00d4d9b5391d487ebe848d9 to your computer and use it in GitHub Desktop.
IntelliJ toString template (uses String.format)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public java.lang.String toString() { | |
return String.format( | |
"$classname [## | |
#set ($i = 0) | |
#foreach ($member in $members) | |
#if ($i != 0) | |
, ## | |
#end | |
$member.name=%s## | |
#set ($i = $i + 1) | |
#end | |
]", | |
#set ($i = 0) | |
#foreach ($member in $members) | |
#if ($i != 0) | |
, | |
#end | |
#if ($member.primitiveArray || $member.objectArray) | |
java.util.Arrays.toString(this.$member.name)## | |
#else | |
this.$member.name ## | |
#end | |
#set ($i = $i + 1) | |
#end | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment