/** Creates the dispatcher class. Make sure, that this method
* is invoked <em>after</em> {@link #addClass(JavaSource, JavaSourceResolver)}!
* @param pQName Fully qualified class name of the dispatcher class.
*/
public JavaSource getDispatcher(JavaQName pQName) {
JavaSource js = getFactory().newJavaSource(pQName, JavaSource.PUBLIC);
if (isDispatcherImplementsXmlRpcHandler()) {
js.addImport(JavaQNameImpl.getInstance("org.apache.xmlrpc.XmlRpcHandler", true));
}
JavaComment comment = js.newComment();
comment.addLine("The dispatcher is being used by the XmlRpcServer.");
comment.addLine("It delegates incoming XML-RPC calls to the classes");
comment.addLine("and methods, for which client classes have been");
comment.addLine("created by the " +
XmlRpcClientGenerator.class.getName() + ".");
JavaSource invoker = getInvokerClass(js);
JavaField map = getInvokerMap(js);
getDispatcherConstructor(js, map, invoker.getQName());
getGetInvokerMethod(js, invoker.getQName(), map);
getDispatcherInvokeMethod(js, invoker.getQName());
return js;
}