[英]Google Web Toolkit Autobeans
出於好奇,我檢查了autobeans
的生成方式。 我發現它使用sun.misc.ProxyGenerator
類生成autobean
proxies
,並且它使用reflections
。 但是我不明白,它在客戶端如何工作。 那些使用reflections
方法是否已編譯為javascript
? 這是否意味着我可以在客戶端上使用自己的反射?
代理實例僅在反射有效的真實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
)協助完成這項工作。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.