Modified toString() to be more extensible.

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1151 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2002-03-26 22:56:54 +00:00
parent aca95b8540
commit 31140a7e3e
@@ -1,5 +1,5 @@
//
// $Id: SimpleStreamableObject.java,v 1.1 2002/02/02 08:48:03 mdb Exp $
// $Id: SimpleStreamableObject.java,v 1.2 2002/03/26 22:56:54 mdb Exp $
package com.threerings.presents.io;
@@ -40,6 +40,17 @@ public class SimpleStreamableObject
*/
public String toString ()
{
return StringUtil.fieldsToString(this);
StringBuffer buf = new StringBuffer("[");
toString(buf);
return buf.append("]").toString();
}
/**
* Derived classes can override this method and add non-public members
* to the <code>toString()</code> output.
*/
protected void toString (StringBuffer buf)
{
StringUtil.fieldsToString(buf, this);
}
}