It's common practice to use inner classes in Java for listeners or other simple things like callbacks. What you want to do in the case of a callback, is invoking a method after the the asynchronous RPC has been finished. The easiest solution would be, to put this method as an argument to the RPC method, but since Java has no closures, using inner classes is a nice solution. In Java 1.4, where no inner classes where available, people implemented the AsyncCallback interface in the class, which was calling the RPC method, so they could do something like:
service.getSomthing(this); But with Java 5 inner classes have become the prefered way. Sure, you can also create your own class for this, but that's the worse practice, I think. What would be the best solution for this, you think? Regards Jan Ehrhardt On Sat, Aug 22, 2009 at 10:43 PM, jack <[email protected]> wrote: > > In every RPC example I've seen, AsyncCallback are all defined inline? > Why is this so? What are the advantages? > > Thanks in advance > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
