I’m picking up someone else work and this is keeping me puzzled:
Got 2 interfaces
public interface WebAuthenticationServiceAsync {
void authenticate(String userName, String password, AsyncCallback callback);}
public interface WebAuthenticationService extends RemoteService {
ArrayList authenticate(String userName, String password); }
There are no classes that implement those in the whole project
and then I got:
authenticationService = (WebAuthenticationServiceAsync)GWT.create(WebAuthenticationService.class);
1.- I understand that .create() is the reflection mechanism on GWT, but both are interfaces, I don’t know what I’m obtaining or how.
2.- I know that casting replaces Arraylist authenticate() with void authenticate(), if thats the case should I just do WebAuthemticationServiceAsync extends RemoteService, and get rid of the WebAuthenticationService one?
These are GWT-RPC contracts, you can read more at: http://code.google.com/webtoolkit/doc/latest/DevGuideServerCommunication.html#DevGuideRemoteProcedureCalls
BTW,
GWT.create()is not about reflection, it’s about replacing a type with another one (say, you have a base implementation, which can be a concrete or abstract class, or an interface, and for, say, Internet Explorer, you’ll use a specific implementation instead) or generating a type. GWT-RPC is in the latter case: the implementation for the interfaces will be generated at compile-time and used instead of theGWT.create()call.Read more about “deferred binding” (i.e. binding the actual type at compile-time rather than “coding time”) at http://code.google.com/webtoolkit/doc/latest/DevGuideCodingBasicsDeferred.html