Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does GWT.create mean and why should I use it?

Tags:

gwt

I am new to GWT. i have below line of code.

SomeClientServiceAsync someService = GWT.create(SomeClientService.class);

what does above line means and why cannot i use any other alternatives to instantiate it?

Please help me!

Thanks.

like image 531
user1016403 Avatar asked Jan 17 '23 18:01

user1016403


2 Answers

GWT.create is used for deferred binding. This allows you to supply different implementations of the same service based on the user's browser. See the following question:

Why use GWT.create() instead of new?

If you do not need to have multiple implementations of your service, just create it via new!

like image 177
ColinE Avatar answered Jan 20 '23 09:01

ColinE


GWT works by creating a service just like RMI does. Here you are creating the service SomeClientService which resides in the client package. It contains all the functions that can be called server-side.

like image 41
Adel Boutros Avatar answered Jan 20 '23 09:01

Adel Boutros