Reputation: 1388
I have some java object and I want to expose all methods of it to custom javascript object. So, seems it would be reasonable to loop over all java object members, via reflection, and generate jsni code like: $wnd.myjso.func1 = function() { @package.MyJavaObject::func1()} and so on... Afterwards generated jsni must be executed to create javascript object on browser's window. How to implement it?
Upvotes: 0
Views: 301
Reputation: 64541
As you cannot use reflection at run-time, you have to do it at compile-time, using a GWT Generator.
That being said, you don't need to write such a generator by yourself, someone (now a Googler, member of the GWT team) has already done so: http://code.google.com/p/gwt-exporter/
Upvotes: 3