Files
narya/lib/decoder.tmpl
T
Michael Bayne f84e832581 Can't have $Id$ in the template because it will be replaced when the
generated file is checked into CVS by the Id info for the generated file,
thus thwarting our efforts to track which version of the template from
which the generated file was generated.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1665 542714f4-19e9-0310-aa3c-eee0fc999fb1
2002-09-06 01:18:25 +00:00

58 lines
1.4 KiB
Cheetah

//
// [% idstr %]
package [% package %];
[% FOREACH import = 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 method = methods -%]
/** The method id used to dispatch {@link [% name %]Receiver#[% method.mname %]}
* notifications. */
public static final int [% method.mcode %] = [% method.mcodeval %];
[% 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 method = methods -%]
case [% method.mcode %]:
(([% name %]Receiver)receiver).[% method.mname %](
[% method.unwrapped_args %]
);
return;
[% END -%]
default:
super.dispatchNotification(methodId, args);
}
}
// Generated on [% genstamp %].
}