pihentagy
pihentagy

Reputation: 6285

gwt, async callbacks and DRY

According to the official doc, an async callback should have 2 interfaces, one of them could be generated from the other. Not mentioning, it is very hard to follow call hierarchy this way. Isn't there a DRY way to define such interfaces?

To add an AsyncCallback parameter to all of our service methods, you must define a new interface as follows:

  • It must have the same name as the service interface, appended with Async (for example, StockPriceServiceAsync).
  • It must be located in the same package as the service interface.
  • Each method must have the same name and signature as in the service interface with an important difference: the method has no return type and the last parameter is an AsyncCallback object.

Upvotes: 0

Views: 83

Answers (1)

Andrea Boscolo
Andrea Boscolo

Reputation: 3048

Well, after you have defined your sync interface (the one implemented by your RemoteServiceServlet extension) you can generate the async interface using:

  • the GWT Plugin for Eclipse, if you use Eclipse (see here);
  • the Maven GWT Plugin, if you use maven (see here);
  • some other libraries.

Upvotes: 4

Related Questions