// add definition for factory to xxx.gwt.xml
{
ModuleDescription moduleDescription = Utils.getSingleModule(packageFragment);
DefaultModuleProvider.modify(moduleDescription, new ModuleModification() {
public void modify(ModuleElement moduleElement) throws Exception {
AbstractModuleElement replaceElement = new AbstractModuleElement("replace-with");
moduleElement.addChild(replaceElement);
replaceElement.setAttribute("class", packageName + "." + className + "Impl");
//
AbstractModuleElement whenElement = new AbstractModuleElement("when-type-is");
replaceElement.addChild(whenElement);
whenElement.setAttribute("class", packageName + "." + className);
}
});
}
return file;
}