【问题标题】:Google Web Toolkit AutobeansGoogle Web Toolkit Autobeans
【发布时间】:2015-08-11 06:09:20
【问题描述】:

出于好奇,我检查了autobeans 是如何生成的。我发现它使用sun.misc.ProxyGenerator 类来生成autobean proxies 并且它使用reflections。但我不明白,它是如何在客户端工作的。那些使用reflections 的方法是否编译为javascript?这是否意味着我可以自己在客户端上使用反射?

【问题讨论】:

    标签: java gwt reflection autobean


    【解决方案1】:

    代理实例仅在服务器上使用,在真正的 JVM 中,反射起作用。 GWT 代码不能使用一般反射是正确的。

    为了在客户端生成它们,使用了 GWT 生成器。这会在 GWT 编译器仍在运行时完成所有反射,在真正的 JVM 中也是如此,并创建实现您的 autobean 接口和工厂的新类。

    com.google.web.bindery.autobean.gwt.rebind.AutoBeanGenerator 类主要负责这项工作,com.google.web.bindery.autobean.gwt.rebind.model 包的内容(在某种程度上,com.google.web.bindery.autobean.shared)有助于这项工作。

    【讨论】:

    • 谢谢!签入调试器 autobean 实现类,他们肯定不会在客户端使用代理!
    猜你喜欢
    • 2012-09-01
    • 1970-01-01
    • 1970-01-01
    • 2011-01-03
    • 1970-01-01
    • 2011-09-03
    • 2011-04-21
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多