Provide an easy way to add to toString() info.

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3806 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Ray Greenwell
2006-01-17 23:28:21 +00:00
parent bf5fff9ee1
commit d67825b213
+18 -6
View File
@@ -377,12 +377,24 @@ public class Table
*/ */
public String toString () public String toString ()
{ {
return "[tableId=" + tableId + StringBuffer buf = new StringBuffer();
", lobbyOid=" + lobbyOid + buf.append(StringUtil.shortClassName(this));
", gameOid=" + gameOid + buf.append(" [");
", occupants=" + StringUtil.toString(occupants) + toString(buf);
", bodyOids=" + StringUtil.toString(bodyOids) + buf.append("]");
", config=" + config + "]"; return buf.toString();
}
/**
* Helper method for toString, ripe for overrideability.
*/
protected void toString (StringBuffer buf)
{
buf.append("tableId=").append(tableId);
buf.append(", lobbyOid=").append(lobbyOid);
buf.append(", gameOid=").append(gameOid);
buf.append(", occupants=").append(StringUtil.toString(occupants));
buf.append(", config=").append(config);
} }
/** A counter for assigning table ids. */ /** A counter for assigning table ids. */