26c928fc45
These are the preferred way to get instances of Boolean, Byte, Short, Character, Integer, Long, Float, and Double object. It's always made sense for Boolean objects, and with 1.5 these factory methods were blessed as the proper way to get instances unless one absolutely needed a distinct object. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4145 542714f4-19e9-0310-aa3c-eee0fc999fb1
54 lines
1.3 KiB
Cheetah
54 lines
1.3 KiB
Cheetah
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);
|
|
return;
|
|
}
|
|
}
|
|
}
|