Implemented StringUtil.fieldsToString() using flash's introspection.

Use it in SimpleStreamableObject's toString(), with some new formatting.
Unfortunately, the order of public variables seems random.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4746 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Ray Greenwell
2007-07-02 20:33:59 +00:00
parent 8022af7815
commit b1773889d2
2 changed files with 35 additions and 2 deletions
@@ -21,7 +21,9 @@
package com.threerings.io {
import com.threerings.util.ClassUtil;
import com.threerings.util.StringBuilder;
import com.threerings.util.StringUtil;
/**
* A simple serializable object implements the {@link Streamable}
@@ -48,8 +50,9 @@ public class SimpleStreamableObject implements Streamable
public function toString () :String
{
var buf :StringBuilder = new StringBuilder("[");
buf.append(ClassUtil.tinyClassName(this)).append("(");
toStringBuilder(buf);
return buf.append("]").toString();
return buf.append(")]").toString();
}
/**
@@ -58,7 +61,7 @@ public class SimpleStreamableObject implements Streamable
*/
protected function toStringBuilder (buf :StringBuilder): void
{
// TODO: StringUtil.fieldsToString(buf, this);
StringUtil.fieldsToString(buf, this);
}
}
}