gpt4 book ai didi

java - Google Web 工具包 Autobeans

转载 作者:行者123 更新时间:2023-12-01 11:15:04 25 4
gpt4 key购买 nike

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

最佳答案

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

为了在客户端生成它们,需要使用 GWT 生成器。这会在 GWT 编译器仍在运行时(在真实的 JVM 中)执行所有反射,并创建实现您的 autobean 接口(interface)和工厂的新类。

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

关于java - Google Web 工具包 Autobeans,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31934389/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com