idea toString()模板,将对象toString()为json格式。
1.
2.点击新增
public java.lang.String toString() { final java.lang.StringBuilder sb = new java.lang.StringBuilder("{"); #set ($i = 0) #foreach ($member in $members)#if ($i == 0) sb.append("##### #else sb.append(",#### #end#if ($member.string || $member.date) \"$member.name\":\"") #else \"$member.name\":") #end#if ($member.primitiveArray || $member.objectArray) .append(java.util.Arrays.toString($member.name)); #elseif ($member.string || $member.date) .append($member.accessor).append(\'\"\'); #else .append($member.accessor); #end#set ($i = $i + 1) #end sb.append(\'}\'); return sb.toString(); }