Modified DObject.toString() to use fieldsToString() so that all of its

derived classes need not do their own toString()ing.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@928 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2002-02-04 01:47:20 +00:00
parent 5bb4e3435b
commit a83e512270
8 changed files with 12 additions and 76 deletions
@@ -1,5 +1,5 @@
//
// $Id: DObject.java,v 1.35 2002/02/04 00:51:15 mdb Exp $
// $Id: DObject.java,v 1.36 2002/02/04 01:47:19 mdb Exp $
package com.threerings.presents.dobj;
@@ -7,6 +7,7 @@ import java.lang.reflect.Field;
import java.util.ArrayList;
import com.samskivert.util.ListUtil;
import com.samskivert.util.StringUtil;
import com.threerings.presents.Log;
/**
@@ -444,22 +445,9 @@ public class DObject
public String toString ()
{
StringBuffer buf = new StringBuffer();
buf.append("[");
toString(buf);
buf.append("]");
return buf.toString();
}
/**
* An extensible mechanism for generating a string representation of
* this object. Derived classes should override this method, calling
* super and then appending their own data to the supplied string
* buffer. The regular {@link #toString} function will call this
* derived function to generate its string.
*/
protected void toString (StringBuffer buf)
{
buf.append("oid=").append(_oid);
buf.append("[oid=").append(_oid).append(", ");
StringUtil.fieldsToString(this);
return buf.append("]").toString();
}
/**
@@ -1,5 +1,5 @@
//
// $Id: AuthResponseData.java,v 1.9 2001/10/11 04:07:53 mdb Exp $
// $Id: AuthResponseData.java,v 1.10 2002/02/04 01:47:20 mdb Exp $
package com.threerings.presents.net;
@@ -21,11 +21,4 @@ public class AuthResponseData extends DObject
* why the authentication failed.
*/
public String code;
// documentation inherited
protected void toString (StringBuffer buf)
{
super.toString(buf);
buf.append(", code=").append(code);
}
}
@@ -1,5 +1,5 @@
//
// $Id: BootstrapData.java,v 1.3 2001/10/11 04:07:53 mdb Exp $
// $Id: BootstrapData.java,v 1.4 2002/02/04 01:47:20 mdb Exp $
package com.threerings.presents.net;
@@ -18,12 +18,4 @@ public class BootstrapData extends DObject
/** The oid to which to send invocation requests. */
public int invOid;
// documentation inherited
public void toString (StringBuffer buf)
{
super.toString(buf);
buf.append(", clientOid=").append(clientOid);
buf.append(", invOid=").append(invOid);
}
}