On Saturday, December 11, 2010 4:02:15 PM UTC+1, UseTheFork wrote:Hi, I am new to GWT and I am trying to understand something not obvious (to me) in Tutorial-Contacts1 code.
The Contacts.onModuleLoad() creates a rpcService instance as folllowing: ContactsServiceAsync rpcService = GWT.create(ContactsService.class); The ContactsServiceAsync and ContactsService interfaces are independant. One does not extend the other in the tutorial code. Yet, the Javadoc indicates that the provided parameter is 'a class literal specifying the base class to be instantiated'. In this case it will trigger a generator, because ContactsService is assignable to RemoteService. (have a look at deferred binding in the docs) i) Does this mean that GWT will automatically generate a Java class implementing ContactsServiceAsync to create the rpcService instance? Yes. I don't see any code implementing ContactsServiceAsync. If you pass the -gen command line arg. to either DevMode or Compiler, you'll see the generated Java code in the specified directory (e.g. "-gen gen" will output generated code into the "gen" directory) ii) Or should I assume that none of the Java code I write for my application is going to be used at runtime, since everything will be converted into Javascript? In DevMode, you'll run Java code (in this case, generated and then compiled on the fly), but of course in the end, everything is translated to JavaScript. -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
