com.threerings.presents.tools.dispatcher.tmpl Maven / Gradle / Ivy
package {{package}};
import javax.annotation.Generated;
{{#imports}}
import {{this}};
{{/imports}}
/**
* Dispatches requests to the {@link {{name}}Provider}.
*/
{{generated}}
public class {{name}}Dispatcher extends InvocationDispatcher<{{name}}Marshaller>
{
/**
* Creates a dispatcher that may be registered to dispatch invocation
* service requests for the specified provider.
*/
public {{name}}Dispatcher ({{name}}Provider provider)
{
this.provider = provider;
}
@Override
public {{name}}Marshaller createMarshaller ()
{
return new {{name}}Marshaller();
}
@Override
public void dispatchRequest (
ClientObject source, int methodId, Object[] args)
throws InvocationException
{
switch (methodId) {
{{#methods}}
case {{name}}Marshaller.{{code}}:
(({{name}}Provider)provider).{{method.name}}(
source{{#hasArgs}}, {{/hasArgs}}{{getUnwrappedArgList}}
);
return;
{{/methods}}
default:
super.dispatchRequest(source, methodId, args);
return;
}
}
}