Rewrote the InvocationReceiver generation process in Java as an Ant task. I had

previously redone the InvocationService and DObject generation tools but not
the InvocationReceiver tool.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3913 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2006-03-06 21:50:23 +00:00
parent a75f496e76
commit 17fdaa7c0d
6 changed files with 284 additions and 384 deletions
@@ -0,0 +1,52 @@
package $package;
#foreach ($import in $imports)
import $import;
#end
/**
* Dispatches calls to a {@link ${name}Receiver} instance.
*/
public class ${name}Decoder extends InvocationDecoder
{
/** The generated hash code used to identify this receiver class. */
public static final String RECEIVER_CODE = "$receiver_code";
#foreach ($m in $methods)
/** The method id used to dispatch {@link ${name}Receiver#$m.method.name}
* notifications. */
public static final int $m.code = $velocityCount;
#end
/**
* Creates a decoder that may be registered to dispatch invocation
* service notifications to the specified receiver.
*/
public ${name}Decoder (${name}Receiver receiver)
{
this.receiver = receiver;
}
// documentation inherited
public String getReceiverCode ()
{
return RECEIVER_CODE;
}
// documentation inherited
public void dispatchNotification (int methodId, Object[] args)
{
switch (methodId) {
#foreach ($m in $methods)
case $m.code:
((${name}Receiver)receiver).${m.method.name}(
$m.getUnwrappedArgList(true)
);
return;
#end
default:
super.dispatchNotification(methodId, args);
}
}
}