Type the marshaller and associated registry methods so that we don't have to

downcast every time we register an invocation service provider.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5201 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2008-06-29 12:36:21 +00:00
parent d9cdb5ae3b
commit 8d6635e8e0
8 changed files with 18 additions and 23 deletions
@@ -102,7 +102,7 @@ public class InvocationManager
*
* @param dispatcher the dispatcher to be registered.
*/
public InvocationMarshaller registerDispatcher (InvocationDispatcher dispatcher)
public <T extends InvocationMarshaller> T registerDispatcher (InvocationDispatcher<T> dispatcher)
{
return registerDispatcher(dispatcher, null);
}
@@ -110,8 +110,8 @@ public class InvocationManager
/**
* @Deprecated use {@link #registerDispatcher(InvocationDispatcher)}.
*/
public InvocationMarshaller registerDispatcher (
InvocationDispatcher dispatcher, boolean bootstrap)
public <T extends InvocationMarshaller> T registerDispatcher (
InvocationDispatcher<T> dispatcher, boolean bootstrap)
{
return registerDispatcher(dispatcher, null);
}
@@ -126,13 +126,14 @@ public class InvocationManager
* groups. You must collect shared dispatchers into as fine grained a set of groups as
* necessary and have different types of clients specify the list of groups they need.
*/
public InvocationMarshaller registerDispatcher (InvocationDispatcher dispatcher, String group)
public <T extends InvocationMarshaller> T registerDispatcher (
InvocationDispatcher<T> dispatcher, String group)
{
// get the next invocation code
int invCode = nextInvCode();
// create the marshaller and initialize it
InvocationMarshaller marsh = dispatcher.createMarshaller();
T marsh = dispatcher.createMarshaller();
marsh.init(_invoid, invCode);
// register the dispatcher