diff --git a/src/main/java/com/threerings/bureau/data/BureauAuthName.java b/src/main/java/com/threerings/bureau/data/BureauAuthName.java index 31ec9aaa7..cc0ae596a 100644 --- a/src/main/java/com/threerings/bureau/data/BureauAuthName.java +++ b/src/main/java/com/threerings/bureau/data/BureauAuthName.java @@ -32,9 +32,4 @@ public class BureauAuthName extends Name { super(bureauId); } - - // used when unserializing - public BureauAuthName () - { - } } diff --git a/src/main/java/com/threerings/crowd/chat/data/ChatMessage.java b/src/main/java/com/threerings/crowd/chat/data/ChatMessage.java index 1ac5b9aec..8428e8bd2 100644 --- a/src/main/java/com/threerings/crowd/chat/data/ChatMessage.java +++ b/src/main/java/com/threerings/crowd/chat/data/ChatMessage.java @@ -47,13 +47,6 @@ public abstract class ChatMessage @ActionScript(type="int") public transient long timestamp; - /** - * For all your unserialization needs. - */ - public ChatMessage () - { - } - /** * Construct a ChatMessage. */ diff --git a/src/main/java/com/threerings/crowd/chat/data/SystemMessage.java b/src/main/java/com/threerings/crowd/chat/data/SystemMessage.java index 8cbbd1d9e..53e262237 100644 --- a/src/main/java/com/threerings/crowd/chat/data/SystemMessage.java +++ b/src/main/java/com/threerings/crowd/chat/data/SystemMessage.java @@ -40,11 +40,6 @@ public class SystemMessage extends ChatMessage /** The attention level of this message. */ public byte attentionLevel; - // documentation inherited - public SystemMessage () - { - } - /** * Construct a SystemMessage. */ diff --git a/src/main/java/com/threerings/crowd/chat/data/UserMessage.java b/src/main/java/com/threerings/crowd/chat/data/UserMessage.java index c5e6bf552..a8822a4a8 100644 --- a/src/main/java/com/threerings/crowd/chat/data/UserMessage.java +++ b/src/main/java/com/threerings/crowd/chat/data/UserMessage.java @@ -35,10 +35,12 @@ public class UserMessage extends ChatMessage public byte mode; /** - * For unserialization. + * Constructs a user message for a player originated tell (which has no bundle and is in the + * default mode). */ - public UserMessage () + public static UserMessage create (Name speaker, String message) { + return new UserMessage(speaker, null, message, ChatCodes.DEFAULT_MODE); } /** @@ -51,17 +53,6 @@ public class UserMessage extends ChatMessage this.mode = mode; } - /** - * Constructs a user message for a player originated tell (which has no bundle and is in the - * default mode). - */ - public UserMessage (Name speaker, String message) - { - super(message, null); - this.speaker = speaker; - this.mode = ChatCodes.DEFAULT_MODE; - } - /** * Returns the name to display for the speaker. Some types of messages may wish to not use the * canonical name for the speaker and should thus override this function. diff --git a/src/main/java/com/threerings/crowd/chat/data/UserSystemMessage.java b/src/main/java/com/threerings/crowd/chat/data/UserSystemMessage.java index 88ea08e31..3a0544785 100644 --- a/src/main/java/com/threerings/crowd/chat/data/UserSystemMessage.java +++ b/src/main/java/com/threerings/crowd/chat/data/UserSystemMessage.java @@ -32,17 +32,12 @@ public class UserSystemMessage extends SystemMessage /** The "speaker" of this message, the user that triggered that this message be sent to us. */ public Name speaker; - /** Suitable for unserialization. */ - public UserSystemMessage () - { - } - /** * Construct a INFO-level UserSystemMessage. */ - public UserSystemMessage (Name sender, String message, String bundle) + public static UserSystemMessage create (Name sender, String message, String bundle) { - this(sender, message, bundle, INFO); + return new UserSystemMessage(sender, message, bundle, INFO); } /** diff --git a/src/main/java/com/threerings/crowd/chat/server/ChatHistory.java b/src/main/java/com/threerings/crowd/chat/server/ChatHistory.java index 8a5c56be4..e7a182fd5 100644 --- a/src/main/java/com/threerings/crowd/chat/server/ChatHistory.java +++ b/src/main/java/com/threerings/crowd/chat/server/ChatHistory.java @@ -54,26 +54,16 @@ public class ChatHistory * {@link #record(ChatChannel, UserMessage, Name...)}, * {@link #get(Name)}, and {@link #clear(Name)}. */ - public static class Entry - implements Streamable + public static class Entry implements Streamable { /** The channel on which the message was sent, of null if the channel manager was not * used. */ - public ChatChannel channel; + public final ChatChannel channel; /** The message sent. */ - public ChatMessage message; + public final ChatMessage message; - /** For deserialization. */ - public Entry () - { - } - - /** - * Creates a new history entry. - */ - public Entry (ChatChannel channel, ChatMessage message) - { + public Entry (ChatChannel channel, ChatMessage message) { this.channel = channel; this.message = message; } diff --git a/src/main/java/com/threerings/crowd/chat/server/ChatProvider.java b/src/main/java/com/threerings/crowd/chat/server/ChatProvider.java index f7dfd707c..9186e8448 100644 --- a/src/main/java/com/threerings/crowd/chat/server/ChatProvider.java +++ b/src/main/java/com/threerings/crowd/chat/server/ChatProvider.java @@ -271,7 +271,7 @@ public class ChatProvider */ protected UserMessage createTellMessage (BodyObject source, String message) { - return new UserMessage(source.getVisibleName(), message); + return UserMessage.create(source.getVisibleName(), message); } /** diff --git a/src/main/java/com/threerings/crowd/data/BodyObject.java b/src/main/java/com/threerings/crowd/data/BodyObject.java index d781e9641..f4b8598a8 100644 --- a/src/main/java/com/threerings/crowd/data/BodyObject.java +++ b/src/main/java/com/threerings/crowd/data/BodyObject.java @@ -245,5 +245,5 @@ public class BodyObject extends ClientObject } /** The default (no tokens) access control. */ - protected static final TokenRing EMPTY_TOKENS = new TokenRing(); + protected static final TokenRing EMPTY_TOKENS = new TokenRing(0); } diff --git a/src/main/java/com/threerings/crowd/data/OccupantInfo.java b/src/main/java/com/threerings/crowd/data/OccupantInfo.java index 78e315702..095c33bfb 100644 --- a/src/main/java/com/threerings/crowd/data/OccupantInfo.java +++ b/src/main/java/com/threerings/crowd/data/OccupantInfo.java @@ -89,7 +89,7 @@ public class OccupantInfo extends SimpleStreamableObject } /** The body object id of this occupant (and our entry key). */ - public Integer bodyOid; + public final Integer bodyOid; /** The username of this occupant. */ public Name username; @@ -107,11 +107,6 @@ public class OccupantInfo extends SimpleStreamableObject status = body.status; } - /** A blank constructor used for unserialization. */ - public OccupantInfo () - { - } - /** Access to the body object id as an int. */ public int getBodyOid () { diff --git a/src/main/java/com/threerings/crowd/data/Place.java b/src/main/java/com/threerings/crowd/data/Place.java index 2f631d777..add69b55f 100644 --- a/src/main/java/com/threerings/crowd/data/Place.java +++ b/src/main/java/com/threerings/crowd/data/Place.java @@ -29,12 +29,7 @@ import com.threerings.io.SimpleStreamableObject; public class Place extends SimpleStreamableObject { /** The oid of this place's {@link PlaceObject}. */ - public int placeOid; - - /** Used when unserializing. */ - public Place () - { - } + public final int placeOid; /** * Creates a place with the supplied oid. diff --git a/src/main/java/com/threerings/crowd/data/TokenRing.java b/src/main/java/com/threerings/crowd/data/TokenRing.java index 8e27fe74c..2c2084789 100644 --- a/src/main/java/com/threerings/crowd/data/TokenRing.java +++ b/src/main/java/com/threerings/crowd/data/TokenRing.java @@ -33,13 +33,6 @@ public class TokenRing extends SimpleStreamableObject /** Indicates that this user is an administrator. */ public static final int ADMIN = (1 << 0); - /** - * A default constructor, used when unserializing token rings. - */ - public TokenRing () - { - } - /** * Constructs a token ring with the supplied set of tokens. */ diff --git a/src/main/java/com/threerings/presents/dobj/AttributeChangedEvent.java b/src/main/java/com/threerings/presents/dobj/AttributeChangedEvent.java index e9ad1ec62..52448b550 100644 --- a/src/main/java/com/threerings/presents/dobj/AttributeChangedEvent.java +++ b/src/main/java/com/threerings/presents/dobj/AttributeChangedEvent.java @@ -36,14 +36,6 @@ import com.threerings.presents.net.Transport; */ public class AttributeChangedEvent extends NamedEvent { - /** - * Constructs a blank instance of this event in preparation for unserialization from the - * network. - */ - public AttributeChangedEvent () - { - } - /** * Returns the new value of the attribute. */ @@ -150,21 +142,6 @@ public class AttributeChangedEvent extends NamedEvent return true; } - /** - * Constructs a new attribute changed event on the specified target object with the supplied - * attribute name and value. Do not construct these objects by hand. Use {@link - * DObject#changeAttribute} instead. - * - * @param targetOid the object id of the object whose attribute has changed. - * @param name the name of the attribute (data member) that has changed. - * @param value the new value of the attribute (in the case of primitive types, the - * reflection-defined object-alternative is used). - */ - protected AttributeChangedEvent (int targetOid, String name, Object value, Object oldValue) - { - this(targetOid, name, value, oldValue, Transport.DEFAULT); - } - /** * Constructs a new attribute changed event on the specified target object with the supplied * attribute name and value. Do not construct these objects by hand. Use {@link diff --git a/src/main/java/com/threerings/presents/dobj/CompoundEvent.java b/src/main/java/com/threerings/presents/dobj/CompoundEvent.java index 7b696e3a0..e6c5c506a 100644 --- a/src/main/java/com/threerings/presents/dobj/CompoundEvent.java +++ b/src/main/java/com/threerings/presents/dobj/CompoundEvent.java @@ -35,19 +35,12 @@ import com.threerings.presents.net.Transport; */ public class CompoundEvent extends DEvent { - /** - * Constructs a blank compound event in preparation for unserialization. - */ - public CompoundEvent () - { - } - /** * Constructs a compound event and prepares it for operation. */ public CompoundEvent (DObject target, DObjectManager omgr) { - super(target.getOid()); + super(target.getOid(), Transport.DEFAULT); // sanity check if (omgr == null) { diff --git a/src/main/java/com/threerings/presents/dobj/DEvent.java b/src/main/java/com/threerings/presents/dobj/DEvent.java index 55b9c6667..ab8112bbc 100644 --- a/src/main/java/com/threerings/presents/dobj/DEvent.java +++ b/src/main/java/com/threerings/presents/dobj/DEvent.java @@ -36,21 +36,6 @@ public abstract class DEvent implements Streamable * increasing fashion when the event is posted to the event dispatch queue. */ public transient long eventId; - /** - * A zero argument constructor for unserialization from yon network. - */ - public DEvent () - { - } - - /** - * Constructs a new distributed object event that pertains to the specified distributed object. - */ - public DEvent (int targetOid) - { - this(targetOid, Transport.DEFAULT); - } - /** * Constructs a new distributed object event that pertains to the specified distributed object. * diff --git a/src/main/java/com/threerings/presents/dobj/DObject.java b/src/main/java/com/threerings/presents/dobj/DObject.java index 837666b47..efcfb8fac 100644 --- a/src/main/java/com/threerings/presents/dobj/DObject.java +++ b/src/main/java/com/threerings/presents/dobj/DObject.java @@ -903,7 +903,7 @@ public class DObject if (applyImmediately) { list.add(oid); } - postEvent(new ObjectAddedEvent(_oid, name, oid, applyImmediately)); + postEvent(new ObjectAddedEvent(_oid, name, oid).setAlreadyApplied(applyImmediately)); } /** @@ -917,19 +917,19 @@ public class DObject list.remove(oid); } // dispatch an object removed event - postEvent(new ObjectRemovedEvent(_oid, name, oid, applyImmediately)); + postEvent(new ObjectRemovedEvent(_oid, name, oid).setAlreadyApplied(applyImmediately)); } /** @deprecated Regenerate your DObject to remove this warning. */ @Deprecated protected void requestOidAdd (String name, int oid) { - postEvent(new ObjectAddedEvent(_oid, name, oid, false)); + postEvent(new ObjectAddedEvent(_oid, name, oid)); } /** @deprecated Regenerate your DObject to remove this warning. */ @Deprecated protected void requestOidRemove (String name, int oid) { - postEvent(new ObjectRemovedEvent(_oid, name, oid, false)); + postEvent(new ObjectRemovedEvent(_oid, name, oid)); } /** @@ -943,7 +943,7 @@ public class DObject set.add(entry); } // dispatch an entry added event - postEvent(new EntryAddedEvent(_oid, name, entry, applyImmediately)); + postEvent(new EntryAddedEvent(_oid, name, entry).setAlreadyApplied(applyImmediately)); } /** diff --git a/src/main/java/com/threerings/presents/dobj/ElementUpdatedEvent.java b/src/main/java/com/threerings/presents/dobj/ElementUpdatedEvent.java index f8f2457de..f6ad25986 100644 --- a/src/main/java/com/threerings/presents/dobj/ElementUpdatedEvent.java +++ b/src/main/java/com/threerings/presents/dobj/ElementUpdatedEvent.java @@ -37,23 +37,6 @@ import com.threerings.presents.net.Transport; */ public class ElementUpdatedEvent extends NamedEvent { - /** - * Constructs a new element updated event on the specified target object with the supplied - * attribute name, element and index. - * - * @param targetOid the object id of the object whose attribute has changed. - * @param name the name of the attribute (data member) for which an element has changed. - * @param value the new value of the element (in the case of primitive types, the - * reflection-defined object-alternative is used). - * @param ovalue the previous value of the element (in the case of primitive types, the - * reflection-defined object-alternative is used). - * @param index the index in the array of the updated element. - */ - public ElementUpdatedEvent (int targetOid, String name, Object value, Object ovalue, int index) - { - this(targetOid, name, value, ovalue, index, Transport.DEFAULT); - } - /** * Constructs a new element updated event on the specified target object with the supplied * attribute name, element and index. @@ -76,14 +59,6 @@ public class ElementUpdatedEvent extends NamedEvent _index = index; } - /** - * Constructs a blank instance of this event in preparation for unserialization from the - * network. - */ - public ElementUpdatedEvent () - { - } - /** * Returns the new value of the element. */ diff --git a/src/main/java/com/threerings/presents/dobj/EntryAddedEvent.java b/src/main/java/com/threerings/presents/dobj/EntryAddedEvent.java index f585a8963..c94c6d647 100644 --- a/src/main/java/com/threerings/presents/dobj/EntryAddedEvent.java +++ b/src/main/java/com/threerings/presents/dobj/EntryAddedEvent.java @@ -23,6 +23,8 @@ package com.threerings.presents.dobj; import com.samskivert.util.StringUtil; +import com.threerings.presents.net.Transport; + /** * An entry added event is dispatched when an entry is added to a {@link DSet} attribute of a * distributed entry. It can also be constructed to request the addition of an entry to a set and @@ -45,25 +47,8 @@ public class EntryAddedEvent extends EntryEvent */ public EntryAddedEvent (int targetOid, String name, T entry) { - this(targetOid, name, entry, false); - } - - /** - * Used when the distributed object already added the entry before generating the event. - */ - public EntryAddedEvent (int targetOid, String name, T entry, boolean alreadyApplied) - { - super(targetOid, name); + super(targetOid, name, Transport.DEFAULT); _entry = entry; - _alreadyApplied = alreadyApplied; - } - - /** - * Constructs a blank instance of this event in preparation for unserialization from the - * network. - */ - public EntryAddedEvent () - { } @Override @@ -128,6 +113,13 @@ public class EntryAddedEvent extends EntryEvent StringUtil.toString(buf, _entry); } + /** Used by {@link DObject} to note if this event has already been applied locally. */ + protected EntryAddedEvent setAlreadyApplied (boolean alreadyApplied) + { + _alreadyApplied = alreadyApplied; + return this; + } + protected T _entry; /** Used when this event is generated on the authoritative server where object changes are made diff --git a/src/main/java/com/threerings/presents/dobj/EntryEvent.java b/src/main/java/com/threerings/presents/dobj/EntryEvent.java index a9b2f6ee7..b5b57f56c 100644 --- a/src/main/java/com/threerings/presents/dobj/EntryEvent.java +++ b/src/main/java/com/threerings/presents/dobj/EntryEvent.java @@ -28,17 +28,6 @@ import com.threerings.presents.net.Transport; */ public abstract class EntryEvent extends NamedEvent { - /** - * Constructs a new event for the specified target object with the supplied attribute name. - * - * @param targetOid the object id of the object in question. - * @param name the name associated with this event. - */ - public EntryEvent (int targetOid, String name) - { - super(targetOid, name); - } - /** * Constructs a new event for the specified target object with the supplied attribute name. * @@ -51,11 +40,6 @@ public abstract class EntryEvent extends NamedEvent super(targetOid, name, transport); } - /** For unserialization. */ - public EntryEvent () - { - } - /** * Return the key that identifies the entry related to this event. * Never returns null. diff --git a/src/main/java/com/threerings/presents/dobj/EntryRemovedEvent.java b/src/main/java/com/threerings/presents/dobj/EntryRemovedEvent.java index 72250e909..0d93c4952 100644 --- a/src/main/java/com/threerings/presents/dobj/EntryRemovedEvent.java +++ b/src/main/java/com/threerings/presents/dobj/EntryRemovedEvent.java @@ -21,6 +21,8 @@ package com.threerings.presents.dobj; +import com.threerings.presents.net.Transport; + import static com.threerings.presents.Log.log; /** @@ -46,19 +48,11 @@ public class EntryRemovedEvent extends EntryEvent */ public EntryRemovedEvent (int targetOid, String name, Comparable key, T oldEntry) { - super(targetOid, name); + super(targetOid, name, Transport.DEFAULT); _key = key; _oldEntry = oldEntry; } - /** - * Constructs a blank instance of this event in preparation for unserialization from the - * network. - */ - public EntryRemovedEvent () - { - } - @Override public Comparable getKey () { diff --git a/src/main/java/com/threerings/presents/dobj/EntryUpdatedEvent.java b/src/main/java/com/threerings/presents/dobj/EntryUpdatedEvent.java index 8cb4d97b1..89115d3e8 100644 --- a/src/main/java/com/threerings/presents/dobj/EntryUpdatedEvent.java +++ b/src/main/java/com/threerings/presents/dobj/EntryUpdatedEvent.java @@ -38,20 +38,6 @@ import static com.threerings.presents.Log.log; */ public class EntryUpdatedEvent extends EntryEvent { - /** - * Constructs a new entry updated event on the specified target object for the specified set - * name and with the supplied updated entry. - * - * @param targetOid the object id of the object to whose set we will add an entry. - * @param name the name of the attribute in which to update the specified entry. - * @param entry the entry to update. - * @param oldEntry the previous value of the entry. - */ - public EntryUpdatedEvent (int targetOid, String name, T entry, T oldEntry) - { - this(targetOid, name, entry, oldEntry, Transport.DEFAULT); - } - /** * Constructs a new entry updated event on the specified target object for the specified set * name and with the supplied updated entry. @@ -69,14 +55,6 @@ public class EntryUpdatedEvent extends EntryEvent _oldEntry = oldEntry; } - /** - * Constructs a blank instance of this event in preparation for unserialization from the - * network. - */ - public EntryUpdatedEvent () - { - } - @Override public Comparable getKey () { diff --git a/src/main/java/com/threerings/presents/dobj/InvocationNotificationEvent.java b/src/main/java/com/threerings/presents/dobj/InvocationNotificationEvent.java index 1eb9445bc..f44ffddaa 100644 --- a/src/main/java/com/threerings/presents/dobj/InvocationNotificationEvent.java +++ b/src/main/java/com/threerings/presents/dobj/InvocationNotificationEvent.java @@ -26,44 +26,21 @@ import com.samskivert.util.StringUtil; import com.threerings.presents.net.Transport; /** - * Used to dispatch an invocation notification from the server to a - * client. + * Used to dispatch an invocation notification from the server to a client. * * @see DObjectManager#postEvent */ public class InvocationNotificationEvent extends DEvent { /** - * Constructs a new invocation notification event on the specified - * target object with the supplied receiver id, method id and - * arguments. + * Constructs a new invocation notification event on the specified target object with the + * supplied receiver id, method id and arguments. * - * @param targetOid the object id of the object on which the event is - * to be dispatched. - * @param receiverId identifies the receiver to which this notification - * is being dispatched. + * @param targetOid the object id of the object on which the event is to be dispatched. + * @param receiverId identifies the receiver to which this notification is being dispatched. * @param methodId the id of the method to be invoked. - * @param args the arguments for the method. This array should contain - * only values of valid distributed object types. - */ - public InvocationNotificationEvent ( - int targetOid, short receiverId, int methodId, Object[] args) - { - this(targetOid, receiverId, methodId, args, Transport.DEFAULT); - } - - /** - * Constructs a new invocation notification event on the specified - * target object with the supplied receiver id, method id and - * arguments. - * - * @param targetOid the object id of the object on which the event is - * to be dispatched. - * @param receiverId identifies the receiver to which this notification - * is being dispatched. - * @param methodId the id of the method to be invoked. - * @param args the arguments for the method. This array should contain - * only values of valid distributed object types. + * @param args the arguments for the method. This array should contain only values of valid + * distributed object types. * @param transport a hint as to the type of transport desired for the event. */ public InvocationNotificationEvent ( @@ -75,14 +52,6 @@ public class InvocationNotificationEvent extends DEvent _args = args; } - /** - * Constructs a blank instance of this event in preparation for - * unserialization from the network. - */ - public InvocationNotificationEvent () - { - } - /** * Returns the receiver id associated with this notification. */ diff --git a/src/main/java/com/threerings/presents/dobj/InvocationRequestEvent.java b/src/main/java/com/threerings/presents/dobj/InvocationRequestEvent.java index 1b8b7bd5a..87a98f531 100644 --- a/src/main/java/com/threerings/presents/dobj/InvocationRequestEvent.java +++ b/src/main/java/com/threerings/presents/dobj/InvocationRequestEvent.java @@ -33,32 +33,14 @@ import com.threerings.presents.net.Transport; public class InvocationRequestEvent extends DEvent { /** - * Constructs a new invocation request event on the specified target - * object with the supplied code, method and arguments. + * Constructs a new invocation request event on the specified target object with the supplied + * code, method and arguments. * - * @param targetOid the object id of the object on which the event is - * to be dispatched. + * @param targetOid the object id of the object on which the event is to be dispatched. * @param invCode the invocation provider identification code. * @param methodId the id of the method to be invoked. - * @param args the arguments for the method. This array should contain - * only values of valid distributed object types. - */ - public InvocationRequestEvent ( - int targetOid, int invCode, int methodId, Object[] args) - { - this(targetOid, invCode, methodId, args, Transport.DEFAULT); - } - - /** - * Constructs a new invocation request event on the specified target - * object with the supplied code, method and arguments. - * - * @param targetOid the object id of the object on which the event is - * to be dispatched. - * @param invCode the invocation provider identification code. - * @param methodId the id of the method to be invoked. - * @param args the arguments for the method. This array should contain - * only values of valid distributed object types. + * @param args the arguments for the method. This array should contain only values of valid + * distributed object types. * @param transport a hint as to the type of transport desired for the event. */ public InvocationRequestEvent ( @@ -70,14 +52,6 @@ public class InvocationRequestEvent extends DEvent _args = args; } - /** - * Constructs a blank instance of this event in preparation for - * unserialization from the network. - */ - public InvocationRequestEvent () - { - } - /** * Returns the invocation code associated with this request. */ diff --git a/src/main/java/com/threerings/presents/dobj/InvocationResponseEvent.java b/src/main/java/com/threerings/presents/dobj/InvocationResponseEvent.java index 74bc6d551..96ee67b32 100644 --- a/src/main/java/com/threerings/presents/dobj/InvocationResponseEvent.java +++ b/src/main/java/com/threerings/presents/dobj/InvocationResponseEvent.java @@ -33,32 +33,14 @@ import com.threerings.presents.net.Transport; public class InvocationResponseEvent extends DEvent { /** - * Constructs a new invocation response event on the specified target - * object with the supplied code, method and arguments. + * Constructs a new invocation response event on the specified target object with the supplied + * code, method and arguments. * - * @param targetOid the object id of the object on which the event is - * to be dispatched. + * @param targetOid the object id of the object on which the event is to be dispatched. * @param requestId the id of the request to which we are responding. * @param methodId the method to be invoked. - * @param args the arguments for the method. This array should contain - * only values of valid distributed object types. - */ - public InvocationResponseEvent ( - int targetOid, int requestId, int methodId, Object[] args) - { - this(targetOid, requestId, methodId, args, Transport.DEFAULT); - } - - /** - * Constructs a new invocation response event on the specified target - * object with the supplied code, method and arguments. - * - * @param targetOid the object id of the object on which the event is - * to be dispatched. - * @param requestId the id of the request to which we are responding. - * @param methodId the method to be invoked. - * @param args the arguments for the method. This array should contain - * only values of valid distributed object types. + * @param args the arguments for the method. This array should contain only values of valid + * distributed object types. * @param transport a hint as to the type of transport desired for the event. */ public InvocationResponseEvent ( @@ -70,14 +52,6 @@ public class InvocationResponseEvent extends DEvent _args = args; } - /** - * Constructs a blank instance of this event in preparation for - * unserialization from the network. - */ - public InvocationResponseEvent () - { - } - /** * Returns the invocation request id associated with this response. */ diff --git a/src/main/java/com/threerings/presents/dobj/MessageEvent.java b/src/main/java/com/threerings/presents/dobj/MessageEvent.java index 490c9c47d..d553b1d3f 100644 --- a/src/main/java/com/threerings/presents/dobj/MessageEvent.java +++ b/src/main/java/com/threerings/presents/dobj/MessageEvent.java @@ -26,10 +26,9 @@ import com.samskivert.util.StringUtil; import com.threerings.presents.net.Transport; /** - * A message event is used to dispatch a message to all subscribers of a - * distributed object without actually changing any of the fields of the - * object. A message has a name, by which different subscribers of the - * same object can distinguish their different messages, and an array of + * A message event is used to dispatch a message to all subscribers of a distributed object without + * actually changing any of the fields of the object. A message has a name, by which different + * subscribers of the same object can distinguish their different messages, and an array of * arguments by which any contents of the message can be delivered. * * @see DObjectManager#postEvent @@ -37,29 +36,13 @@ import com.threerings.presents.net.Transport; public class MessageEvent extends NamedEvent { /** - * Constructs a new message event on the specified target object with - * the supplied name and arguments. + * Constructs a new message event on the specified target object with the supplied name and + * arguments. * - * @param targetOid the object id of the object whose attribute has - * changed. + * @param targetOid the object id of the object whose attribute has changed. * @param name the name of the message event. - * @param args the arguments for this message. This array should - * contain only values of valid distributed object types. - */ - public MessageEvent (int targetOid, String name, Object[] args) - { - this(targetOid, name, args, Transport.DEFAULT); - } - - /** - * Constructs a new message event on the specified target object with - * the supplied name and arguments. - * - * @param targetOid the object id of the object whose attribute has - * changed. - * @param name the name of the message event. - * @param args the arguments for this message. This array should - * contain only values of valid distributed object types. + * @param args the arguments for this message. This array should contain only values of valid + * distributed object types. * @param transport a hint as to the type of transport desired for the event. */ public MessageEvent (int targetOid, String name, Object[] args, Transport transport) @@ -68,14 +51,6 @@ public class MessageEvent extends NamedEvent _args = args; } - /** - * Constructs a blank instance of this event in preparation for - * unserialization from the network. - */ - public MessageEvent () - { - } - /** * Returns the arguments to this message. */ @@ -85,9 +60,8 @@ public class MessageEvent extends NamedEvent } /** - * Replaces the arguments associated with this message event. - * Note: this should only be called on events that have not - * yet been dispatched into the distributed object system. + * Replaces the arguments associated with this message event. Note: this should only + * be called on events that have not yet been dispatched into the distributed object system. */ public void setArgs (Object[] args) { diff --git a/src/main/java/com/threerings/presents/dobj/NamedEvent.java b/src/main/java/com/threerings/presents/dobj/NamedEvent.java index 4f28dd287..193e5e5cd 100644 --- a/src/main/java/com/threerings/presents/dobj/NamedEvent.java +++ b/src/main/java/com/threerings/presents/dobj/NamedEvent.java @@ -29,18 +29,6 @@ import com.threerings.presents.net.Transport; */ public abstract class NamedEvent extends DEvent { - /** - * Constructs a new named event for the specified target object with - * the supplied attribute name. - * - * @param targetOid the object id of the object in question. - * @param name the name associated with this event. - */ - public NamedEvent (int targetOid, String name) - { - this(targetOid, name, Transport.DEFAULT); - } - /** * Constructs a new named event for the specified target object with * the supplied attribute name. @@ -55,14 +43,6 @@ public abstract class NamedEvent extends DEvent _name = name; } - /** - * Constructs a blank instance of this event in preparation for - * unserialization from the network. - */ - public NamedEvent () - { - } - /** * Returns the name of the attribute to which this event pertains. */ diff --git a/src/main/java/com/threerings/presents/dobj/ObjectAddedEvent.java b/src/main/java/com/threerings/presents/dobj/ObjectAddedEvent.java index 7f0541578..a1c323fc9 100644 --- a/src/main/java/com/threerings/presents/dobj/ObjectAddedEvent.java +++ b/src/main/java/com/threerings/presents/dobj/ObjectAddedEvent.java @@ -21,10 +21,11 @@ package com.threerings.presents.dobj; +import com.threerings.presents.net.Transport; + /** - * An object added event is dispatched when an object is added to an - * OidList attribute of a distributed object. It can also be - * constructed to request the addition of an oid to an + * An object added event is dispatched when an object is added to an OidList attribute + * of a distributed object. It can also be constructed to request the addition of an oid to an * OidList attribute of an object and posted to the dobjmgr. * * @see DObjectManager#postEvent @@ -32,33 +33,17 @@ package com.threerings.presents.dobj; public class ObjectAddedEvent extends NamedEvent { /** - * Constructs a new object added event on the specified target object - * with the supplied oid list attribute name and object id to add. + * Constructs a new object added event on the specified target object with the supplied oid + * list attribute name and object id to add. * - * @param targetOid the object id of the object to whose oid list we - * will add an oid. - * @param name the name of the attribute (data member) to which to add - * the specified oid. + * @param targetOid the object id of the object to whose oid list we will add an oid. + * @param name the name of the attribute (data member) to which to add the specified oid. * @param oid the oid to add to the oid list attribute. */ public ObjectAddedEvent (int targetOid, String name, int oid) { - this(targetOid, name, oid, false); - } - - protected ObjectAddedEvent (int targetOid, String name, int oid, boolean alreadyApplied) - { - super(targetOid, name); + super(targetOid, name, Transport.DEFAULT); _oid = oid; - _alreadyApplied = alreadyApplied; - } - - /** - * Constructs a blank instance of this event in preparation for - * unserialization from the network. - */ - public ObjectAddedEvent () - { } /** @@ -102,6 +87,13 @@ public class ObjectAddedEvent extends NamedEvent buf.append(", oid=").append(_oid); } + /** Used by {@link DObject} to note if this event has already been applied locally. */ + protected ObjectAddedEvent setAlreadyApplied (boolean alreadyApplied) + { + _alreadyApplied = alreadyApplied; + return this; + } + protected int _oid; protected transient boolean _alreadyApplied; } diff --git a/src/main/java/com/threerings/presents/dobj/ObjectDestroyedEvent.java b/src/main/java/com/threerings/presents/dobj/ObjectDestroyedEvent.java index 3953e9483..11d497fc9 100644 --- a/src/main/java/com/threerings/presents/dobj/ObjectDestroyedEvent.java +++ b/src/main/java/com/threerings/presents/dobj/ObjectDestroyedEvent.java @@ -21,6 +21,8 @@ package com.threerings.presents.dobj; +import com.threerings.presents.net.Transport; + /** * An object destroyed event is dispatched when an object has been removed * from the distributed object system. It can also be constructed to @@ -31,22 +33,13 @@ package com.threerings.presents.dobj; public class ObjectDestroyedEvent extends DEvent { /** - * Constructs a new object destroyed event for the specified - * distributed object. + * Constructs a new object destroyed event for the specified distributed object. * * @param targetOid the object id of the object that will be destroyed. */ public ObjectDestroyedEvent (int targetOid) { - super(targetOid); - } - - /** - * Constructs a blank instance of this event in preparation for - * unserialization from the network. - */ - public ObjectDestroyedEvent () - { + super(targetOid, Transport.DEFAULT); } @Override diff --git a/src/main/java/com/threerings/presents/dobj/ObjectRemovedEvent.java b/src/main/java/com/threerings/presents/dobj/ObjectRemovedEvent.java index b08a4d9b7..036553985 100644 --- a/src/main/java/com/threerings/presents/dobj/ObjectRemovedEvent.java +++ b/src/main/java/com/threerings/presents/dobj/ObjectRemovedEvent.java @@ -21,45 +21,29 @@ package com.threerings.presents.dobj; +import com.threerings.presents.net.Transport; + /** - * An object removed event is dispatched when an object is removed from an - * OidList attribute of a distributed object. It can also be - * constructed to request the removal of an oid from an - * OidList attribute of an object and posted to the dobjmgr. + * An object removed event is dispatched when an object is removed from an OidList + * attribute of a distributed object. It can also be constructed to request the removal of an oid + * from an OidList attribute of an object and posted to the dobjmgr. * * @see DObjectManager#postEvent */ public class ObjectRemovedEvent extends NamedEvent { /** - * Constructs a new object removed event on the specified target - * object with the supplied oid list attribute name and object id to - * remove. + * Constructs a new object removed event on the specified target object with the supplied oid + * list attribute name and object id to remove. * - * @param targetOid the object id of the object from whose oid list we - * will remove an oid. - * @param name the name of the attribute (data member) from which to - * remove the specified oid. + * @param targetOid the object id of the object from whose oid list we will remove an oid. + * @param name the name of the attribute (data member) from which to remove the specified oid. * @param oid the oid to remove from the oid list attribute. */ public ObjectRemovedEvent (int targetOid, String name, int oid) { - this (targetOid, name, oid, false); - } - - protected ObjectRemovedEvent (int targetOid, String name, int oid, boolean alreadyApplied) - { - super(targetOid, name); + super(targetOid, name, Transport.DEFAULT); _oid = oid; - _alreadyApplied = alreadyApplied; - } - - /** - * Constructs a blank instance of this event in preparation for - * unserialization from the network. - */ - public ObjectRemovedEvent () - { } /** @@ -103,6 +87,13 @@ public class ObjectRemovedEvent extends NamedEvent buf.append(", oid=").append(_oid); } + /** Used by {@link DObject} to note if this event has already been applied locally. */ + protected ObjectRemovedEvent setAlreadyApplied (boolean alreadyApplied) + { + _alreadyApplied = alreadyApplied; + return this; + } + protected int _oid; protected transient boolean _alreadyApplied; } diff --git a/src/main/java/com/threerings/presents/dobj/ReleaseLockEvent.java b/src/main/java/com/threerings/presents/dobj/ReleaseLockEvent.java index 569f60a1c..c7138e457 100644 --- a/src/main/java/com/threerings/presents/dobj/ReleaseLockEvent.java +++ b/src/main/java/com/threerings/presents/dobj/ReleaseLockEvent.java @@ -21,37 +21,30 @@ package com.threerings.presents.dobj; +import com.threerings.presents.net.Transport; + /** - * A release lock event is dispatched at the end of a chain of events to - * release a lock that is intended to prevent some application defined - * activity from happening until those events have been processed. This is - * an entirely cooperative locking system, meaning that the application - * will have to explicitly attempt acquisition of the lock to find out if - * the lock has yet been released. These locks don't actually prevent any - * of the distributed object machinery from functioning. + * A release lock event is dispatched at the end of a chain of events to release a lock that is + * intended to prevent some application defined activity from happening until those events have + * been processed. This is an entirely cooperative locking system, meaning that the application + * will have to explicitly attempt acquisition of the lock to find out if the lock has yet been + * released. These locks don't actually prevent any of the distributed object machinery from + * functioning. * * @see DObjectManager#postEvent */ public class ReleaseLockEvent extends NamedEvent { /** - * Constructs a new release lock event for the specified target object - * with the supplied lock name. + * Constructs a new release lock event for the specified target object with the supplied lock + * name. * * @param targetOid the object id of the object in question. * @param name the name of the lock to release. */ public ReleaseLockEvent (int targetOid, String name) { - super(targetOid, name); - } - - /** - * Constructs a blank instance of this event in preparation for - * unserialization from the network. - */ - public ReleaseLockEvent () - { + super(targetOid, name, Transport.DEFAULT); } @Override diff --git a/src/main/java/com/threerings/presents/dobj/ServerMessageEvent.java b/src/main/java/com/threerings/presents/dobj/ServerMessageEvent.java index 588eb58d7..291dbcfbd 100644 --- a/src/main/java/com/threerings/presents/dobj/ServerMessageEvent.java +++ b/src/main/java/com/threerings/presents/dobj/ServerMessageEvent.java @@ -21,6 +21,8 @@ package com.threerings.presents.dobj; +import com.threerings.presents.net.Transport; + /** * A message event that only goes to the server. If generated on the server then it never leaves * the server. @@ -28,25 +30,17 @@ package com.threerings.presents.dobj; public class ServerMessageEvent extends MessageEvent { /** - * Constructs a new message event on the specified target object with - * the supplied name and arguments. + * Constructs a new message event on the specified target object with the supplied name and + * arguments. * - * @param targetOid the object id of the object whose attribute has - * changed. + * @param targetOid the object id of the object whose attribute has changed. * @param name the name of the message event. - * @param args the arguments for this message. This array should - * contain only values of valid distributed object types. + * @param args the arguments for this message. This array should contain only values of valid + * distributed object types. */ public ServerMessageEvent (int targetOid, String name, Object[] args) { - super(targetOid, name, args); - } - - /** - * Suitable for unserialization. - */ - public ServerMessageEvent () - { + super(targetOid, name, args, Transport.DEFAULT); } @Override diff --git a/src/main/java/com/threerings/presents/dobj/SimpleEntry.java b/src/main/java/com/threerings/presents/dobj/SimpleEntry.java index 60ddfe834..dcc16a2ac 100644 --- a/src/main/java/com/threerings/presents/dobj/SimpleEntry.java +++ b/src/main/java/com/threerings/presents/dobj/SimpleEntry.java @@ -31,9 +31,6 @@ import com.threerings.io.Streamable; public class SimpleEntry> implements DSet.Entry { - // Zero arg constructor for unserialization - public SimpleEntry () { } - public SimpleEntry (T key) { _key = key; } diff --git a/src/main/java/com/threerings/presents/peer/data/DObjectAddress.java b/src/main/java/com/threerings/presents/peer/data/DObjectAddress.java index ae7b4b1a5..1d21aa322 100644 --- a/src/main/java/com/threerings/presents/peer/data/DObjectAddress.java +++ b/src/main/java/com/threerings/presents/peer/data/DObjectAddress.java @@ -29,7 +29,11 @@ import com.threerings.io.SimpleStreamableObject; */ public class DObjectAddress extends SimpleStreamableObject { - public DObjectAddress () {} // Deserialization + /** The node on which this object lives.*/ + public final String nodeName; + + /** This object's oid in its node's oid space. */ + public final int oid; public DObjectAddress (String nodeName, int oid) { @@ -37,10 +41,6 @@ public class DObjectAddress extends SimpleStreamableObject this.oid = oid; } - public String nodeName; - - public int oid; - @Override public int hashCode () { diff --git a/src/main/java/com/threerings/presents/peer/data/NodeObject.java b/src/main/java/com/threerings/presents/peer/data/NodeObject.java index c85514240..ecb213189 100644 --- a/src/main/java/com/threerings/presents/peer/data/NodeObject.java +++ b/src/main/java/com/threerings/presents/peer/data/NodeObject.java @@ -75,14 +75,10 @@ public class NodeObject extends DObject implements Comparable, DSet.Entry { /** The resource type. Only resources of the same type will have their ids compared. */ - public String type; + public final String type; /** The resource identifier, which can be null for singleton resources. */ - public Comparable id; - - public Lock () - { - } + public final Comparable id; public Lock (String type, Comparable id) { @@ -124,14 +120,10 @@ public class NodeObject extends DObject public static class CacheData extends SimpleStreamableObject { /** The cache that should be purged. */ - public String cache; + public final String cache; /** The stale data in the cache. */ - public Streamable data; - - public CacheData () - { - } + public final Streamable data; public CacheData (String cache, Streamable data) { diff --git a/src/main/java/com/threerings/presents/peer/data/PeerAuthName.java b/src/main/java/com/threerings/presents/peer/data/PeerAuthName.java index 42411a54f..1400438c6 100644 --- a/src/main/java/com/threerings/presents/peer/data/PeerAuthName.java +++ b/src/main/java/com/threerings/presents/peer/data/PeerAuthName.java @@ -32,9 +32,4 @@ public class PeerAuthName extends Name { super(nodeName); } - - // used when unserializing - public PeerAuthName () - { - } } diff --git a/src/main/java/com/threerings/presents/server/PresentsDObjectMgr.java b/src/main/java/com/threerings/presents/server/PresentsDObjectMgr.java index a56a7fbe2..e940fc109 100644 --- a/src/main/java/com/threerings/presents/server/PresentsDObjectMgr.java +++ b/src/main/java/com/threerings/presents/server/PresentsDObjectMgr.java @@ -53,6 +53,7 @@ import com.threerings.presents.dobj.ObjectRemovedEvent; import com.threerings.presents.dobj.OidList; import com.threerings.presents.dobj.RootDObjectManager; import com.threerings.presents.dobj.Subscriber; +import com.threerings.presents.net.Transport; import static com.threerings.presents.Log.log; @@ -926,7 +927,7 @@ public class PresentsDObjectMgr public AccessObjectEvent (int oid, Subscriber target, int action) { - super(DUMMY_OID); // target the bogus object + super(DUMMY_OID, Transport.DEFAULT); // target the bogus object _oid = oid; _target = target; _action = action; diff --git a/src/main/java/com/threerings/util/Name.java b/src/main/java/com/threerings/util/Name.java index 54e3936da..fd877ec30 100644 --- a/src/main/java/com/threerings/util/Name.java +++ b/src/main/java/com/threerings/util/Name.java @@ -47,11 +47,6 @@ public class Name extends SimpleStreamableObject return (name == null || name.toString().equals(BLANK.toString())); } - /** Creates a blank instance for unserialization. */ - public Name () - { - } - /** * Creates a name instance with the supplied name. */ diff --git a/src/main/java/com/threerings/util/StreamableEnumSet.java b/src/main/java/com/threerings/util/StreamableEnumSet.java index 3274ce83c..ea83a6f2b 100644 --- a/src/main/java/com/threerings/util/StreamableEnumSet.java +++ b/src/main/java/com/threerings/util/StreamableEnumSet.java @@ -142,13 +142,6 @@ public class StreamableEnumSet> extends AbstractSet initContents(); } - /** - * No-arg constructor for deserialization. - */ - public StreamableEnumSet () - { - } - @Override public Iterator iterator () { diff --git a/src/main/java/com/threerings/util/StreamableTuple.java b/src/main/java/com/threerings/util/StreamableTuple.java index 04e9dfdea..a720faf77 100644 --- a/src/main/java/com/threerings/util/StreamableTuple.java +++ b/src/main/java/com/threerings/util/StreamableTuple.java @@ -51,12 +51,4 @@ public class StreamableTuple extends Tuple { super(left, right); } - - /** - * Don't use this constructor! It's only for unstreaming. - */ - public StreamableTuple () - { - super(null, null); - } } diff --git a/src/test/java/com/threerings/io/StreamableTest.java b/src/test/java/com/threerings/io/StreamableTest.java index 1e0f273e9..ae3d90af0 100644 --- a/src/test/java/com/threerings/io/StreamableTest.java +++ b/src/test/java/com/threerings/io/StreamableTest.java @@ -345,9 +345,6 @@ public class StreamableTest this.strizzing = (s == null) ? null : (s + "-izzle"); } - /** Unserialize like the Dickens. */ - public Wacket () {} - // from Wackable public void wack () {