为什么使用GWT.create()而不是新的? [英] Why use GWT.create() instead of new?

查看:142
本文介绍了为什么使用GWT.create()而不是新的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

GWT.create(SomeClass.class) new SomeClass()? p>

为什么你会用另一种呢?

解决方案

<$ c GWT编译器使用$ c> GWT.create 进行延迟绑定。延迟绑定是GWT编译器的一个功能,它通过在编译时生成许多版本的代码来工作,其中只有一个需要在运行时的引导期间由特定客户端加载。



对于那些依赖于这个特定用例的情况,您应该只使用 GWT.create 。例如,当创建一个RPC类时:(MyServiceAsync)GWT.create(MyService.class)。在所有其他情况下,使用 new



更多信息请查看Deferred绑定的GWT页面: http://code.google.com/webtoolkit/doc/latest/DevGuideCodingBasicsDeferred.html

What is the difference between GWT.create(SomeClass.class) and new SomeClass()?

Why would you use one over the other?

解决方案

GWT.create is used by the GWT compiler for deferred binding. Deferred binding is a feature of the GWT compiler that works by generating many versions of code at compile time, only one of which needs to be loaded by a particular client during bootstrapping at runtime.

You should only use the GWT.create for those cases that depend on this specific use case. For example when creating a RPC class: (MyServiceAsync)GWT.create(MyService.class). In all other cases use new.

For more information check the GWT page on Deferred binding: http://code.google.com/webtoolkit/doc/latest/DevGuideCodingBasicsDeferred.html

这篇关于为什么使用GWT.create()而不是新的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆