Factored out code for events that all shared a name; removed

hand-serialization code for fields which are now handled automatically.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2078 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2002-12-20 23:29:04 +00:00
parent 70a79f48e9
commit ee9049fe3e
17 changed files with 85 additions and 539 deletions
@@ -1,15 +1,10 @@
//
// $Id: EntryAddedEvent.java,v 1.8 2002/07/23 05:52:48 mdb Exp $
// $Id: EntryAddedEvent.java,v 1.9 2002/12/20 23:29:04 mdb Exp $
package com.threerings.presents.dobj;
import java.io.IOException;
import com.samskivert.util.StringUtil;
import com.threerings.io.ObjectInputStream;
import com.threerings.io.ObjectOutputStream;
import com.threerings.presents.Log;
/**
@@ -19,7 +14,7 @@ import com.threerings.presents.Log;
*
* @see DObjectManager#postEvent
*/
public class EntryAddedEvent extends DEvent
public class EntryAddedEvent extends NamedEvent
{
/**
* Constructs a new entry added event on the specified target object
@@ -33,8 +28,7 @@ public class EntryAddedEvent extends DEvent
*/
public EntryAddedEvent (int targetOid, String name, DSet.Entry entry)
{
super(targetOid);
_name = name;
super(targetOid, name);
_entry = entry;
}
@@ -46,15 +40,6 @@ public class EntryAddedEvent extends DEvent
{
}
/**
* Returns the name of the set attribute to which an entry has been
* added.
*/
public String getName ()
{
return _name;
}
/**
* Returns the entry that has been added.
*/
@@ -74,28 +59,6 @@ public class EntryAddedEvent extends DEvent
return true;
}
/**
* Writes our custom streamable fields.
*/
public void writeObject (ObjectOutputStream out)
throws IOException
{
super.writeObject(out);
out.writeUTF(_name);
out.writeObject(_entry);
}
/**
* Reads our custom streamable fields.
*/
public void readObject (ObjectInputStream in)
throws IOException, ClassNotFoundException
{
super.readObject(in);
_name = in.readUTF();
_entry = (DSet.Entry)in.readObject();
}
// documentation inherited
protected void notifyListener (Object listener)
{
@@ -109,11 +72,9 @@ public class EntryAddedEvent extends DEvent
{
buf.append("ELADD:");
super.toString(buf);
buf.append(", name=").append(_name);
buf.append(", entry=");
StringUtil.toString(buf, _entry);
}
protected String _name;
protected DSet.Entry _entry;
}