Files
narya/src/java/com/threerings/presents/tools/decoder.tmpl
T
Ray Greenwell 26c928fc45 Use the valueOf factory methods pretty much everywhere.
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
2006-05-24 01:24:24 +00:00

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;
}
}
}