Re: GWT Reflection
To mimic method invocation in GWT you need to generate code that handles all possible methods for a given class. A typical example that exists in GWT is ClientBundleWithLookup which will be generated by GWT and has a method getResource(String name). The generated code of getResource(String name) may look like:
ResourcePrototype getResource(String functionName) {
if("existingFunction1".equals(functionName)) {
return this.functionName();
}
if("existingFunction2".equals(functionName)) {
return this.functionName2();
}
}
So basically it dispatches the method name and calls the method. I think there are some libraries that provide limited reflection support for GWT, but always keep in mind that they probably will generate lots of code that GWT can not optimize away in most cases (like the function above can't be optimized if the input is dynamically calculated).
-- J.
-- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/R8nkNmJ_F4IJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home