I decided to go hog wild and clean up all the type use in Presents which
required some serious bending and folding of the generic type system, but for the most part we managed to avoid any mutilating. The gendobj task now generates properly typed "addToXXX" and "updateXXX" DSet methods based on the parameterized type of the DSet. This might cause unrecompiled code to break, but I don't think there are many cases in the base toolkit where people call DSet adders or updaters. We'll see and I'll add backwards compatibility versions for cases where we need them to support GG games (everything else we can just recompile). git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4245 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -31,7 +31,7 @@ import com.threerings.presents.Log;
|
||||
*
|
||||
* @see DObjectManager#postEvent
|
||||
*/
|
||||
public class EntryRemovedEvent extends NamedEvent
|
||||
public class EntryRemovedEvent<T extends DSet.Entry> extends NamedEvent
|
||||
{
|
||||
/**
|
||||
* Constructs a new entry removed event on the specified target object
|
||||
@@ -45,7 +45,7 @@ public class EntryRemovedEvent extends NamedEvent
|
||||
* @param oldEntry the previous value of the entry.
|
||||
*/
|
||||
public EntryRemovedEvent (int targetOid, String name, Comparable key,
|
||||
DSet.Entry oldEntry)
|
||||
T oldEntry)
|
||||
{
|
||||
super(targetOid, name);
|
||||
_key = key;
|
||||
@@ -65,13 +65,13 @@ public class EntryRemovedEvent extends NamedEvent
|
||||
*/
|
||||
public Comparable getKey ()
|
||||
{
|
||||
return (Comparable)_key;
|
||||
return _key;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the entry that was in the set prior to being updated.
|
||||
*/
|
||||
public DSet.Entry getOldEntry ()
|
||||
public T getOldEntry ()
|
||||
{
|
||||
return _oldEntry;
|
||||
}
|
||||
@@ -83,7 +83,7 @@ public class EntryRemovedEvent extends NamedEvent
|
||||
throws ObjectAccessException
|
||||
{
|
||||
if (_oldEntry == UNSET_OLD_ENTRY) {
|
||||
DSet set = (DSet)target.getAttribute(_name);
|
||||
DSet<T> set = target.getSet(_name);
|
||||
// remove, fetch the previous value for interested callers
|
||||
_oldEntry = set.removeKey(_key);
|
||||
if (_oldEntry == null) {
|
||||
@@ -113,5 +113,6 @@ public class EntryRemovedEvent extends NamedEvent
|
||||
}
|
||||
|
||||
protected Comparable _key;
|
||||
protected transient DSet.Entry _oldEntry = UNSET_OLD_ENTRY;
|
||||
@SuppressWarnings("unchecked")
|
||||
protected transient T _oldEntry = (T)UNSET_OLD_ENTRY;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user