New object streaming code is born!
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1605 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
//
|
||||
// $Id: SimpleStreamableObject.java,v 1.1 2002/07/23 05:42:34 mdb Exp $
|
||||
|
||||
package com.threerings.io;
|
||||
|
||||
import com.samskivert.util.StringUtil;
|
||||
|
||||
/**
|
||||
* A simple serializable object implements the {@link Streamable}
|
||||
* interface and provides a default {@link #toString} implementation which
|
||||
* outputs all public members.
|
||||
*/
|
||||
public class SimpleStreamableObject implements Streamable
|
||||
{
|
||||
/**
|
||||
* Generates a string representation of this instance.
|
||||
*/
|
||||
public String toString ()
|
||||
{
|
||||
StringBuffer buf = new StringBuffer("[");
|
||||
toString(buf);
|
||||
return buf.append("]").toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles the toString-ification of all public members. Derived
|
||||
* classes can override and include non-public members if desired.
|
||||
*/
|
||||
protected void toString (StringBuffer buf)
|
||||
{
|
||||
StringUtil.fieldsToString(buf, this);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user