简体   繁体   English

GWT模块和继承

[英]GWT Modules and Inheritance

What's with all the "inherit" stuff in module descriptor: 模块描述符中所有“继承”的东西是什么:

<inherits name='com.google.gwt.user.User'/>

...inherit what from what? ...继承什么? Why is this necessary? 为什么这是必要的? This feels a lot like the importing of a User class, not inheriting from it? 感觉很像是在导入 User类,而不是从中继承吗? I guess I'm just confused as to why modules "inherit" instead of "import", seeing that its more of a dependency thing. 我想我对为什么模块“继承”而不是“导入”感到困惑,因为它更多地是依赖项。

Perhaps you are right in that "import" or "include" would make more sense than "inherit". 也许您是对的,因为“导入”或“包含”比“继承”更有意义。

As you know you could have both server and client code into the same project or even shared classes. 如您所知,您可以将服务器和客户端代码都放在同一个项目中,甚至可以在共享类中。 It's up to you to organize the java code in any way you want, but the module XML is needed for GWT to find the classes that would need to be translated into javascript. 由您自行决定以哪种方式组织Java代码,但是GWT需要模块XML来查找需要转换为javascript的类。 In any case you are not importing classes here, but other modules, which can include one or more code folders/packages. 无论如何,您不是要在此处导入类,而是要导入其他模块,这些模块可以包括一个或多个代码文件夹/程序包。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM