From 172349abb3cadcd90b94d05c1d45171d51ad680d Mon Sep 17 00:00:00 2001 From: Jamie Doornbos Date: Thu, 14 Aug 2008 20:53:35 +0000 Subject: [PATCH] Give a little bit of information about Client instances when one is logged. This is for the bureau launcher which manages a lot of clients, but seems generally useful. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5322 542714f4-19e9-0310-aa3c-eee0fc999fb1 --- .../threerings/presents/client/Client.java | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/src/java/com/threerings/presents/client/Client.java b/src/java/com/threerings/presents/client/Client.java index 8030b2e81..1e23da127 100644 --- a/src/java/com/threerings/presents/client/Client.java +++ b/src/java/com/threerings/presents/client/Client.java @@ -545,6 +545,37 @@ public class Client notifyObservers(CLIENT_DID_LOGOFF, null); cleanup(null); // this will set _standalone to false } + + // from Object + public String toString () + { + StringBuilder builder = new StringBuilder(); + builder.append(getClass().getSimpleName()).append(" ["); + fieldsToString(builder); + builder.append("]"); + return builder.toString(); + } + + /** + * Adds text representation of fields to the builder. The results will be placed between + * brackets by toString. + */ + public void fieldsToString (StringBuilder builder) + { + builder.append("hostname=").append(_hostname); + if (_ports != null && _ports.length > 0) { + builder.append(", ports="); + StringUtil.toString(builder, _ports); + } + if (_datagramPorts != null && _datagramPorts.length > 0) { + builder.append(", datagramPorts="); + StringUtil.toString(builder, _datagramPorts); + } + builder.append(", clOid=").append(_cloid); + builder.append(", connId=").append(_connectionId); + builder.append(", creds="); + StringUtil.toString(_creds); + } /** * Called by the {@link ClientDObjectMgr} when our bootstrap notification arrives. If the