This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes GWT and the fly likes Why is it I have to supply interface not the implementation to GWT.create()? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » GWT
Bookmark "Why is it I have to supply interface not the implementation to GWT.create()?" Watch "Why is it I have to supply interface not the implementation to GWT.create()?" New topic
Author

Why is it I have to supply interface not the implementation to GWT.create()?

chaitanya karthikk
Ranch Hand

Joined: Sep 15, 2009
Posts: 800

Hi all, I am new to GWT and having many doubts in my mind. I don't know what to answer if anyone asks me. So the questions are

1. Why should I supply an interface to GWT.create() method, instead of supplying the implementation or something else?
2. Why should I create a Async interface again? As of now I am assuming that the async interface tells to the GWT environment that there must be an ajax function in the generated javascript file for all methods declared in the async file.
3. Now the question is, why can't GWT itself create an async interface of its own when all the methods in service and async are same?
4. Why should I make a reference to the async interface like this Async rpc = GWT.create(Service.class);
5. Lastly, what is this pattern/design/architecture or what ever it is?

I can't find the answers on developers.google.com or may be I dint notice them. But I searched hardly and got no answers in the official site.

Can anyone please explain these question? It would be very very useful for me to better understand GWT and not blindly following some set of rules.

Thank you all in advance. Have a good day.


Love all, trust a few, do wrong to none.
chaitanya karthikk
Ranch Hand

Joined: Sep 15, 2009
Posts: 800

Anybody there who can help me?
chaitanya karthikk
Ranch Hand

Joined: Sep 15, 2009
Posts: 800

Hi al, I am trying to get help from google. But there is no related information there or may be I don't know which key to each for. Can anyone please answer my questions?

Thank you all in advance.
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 9930
    
159

chaitanya karthikk wrote:Hi al, I am trying to get help from google. But there is no related information there or may be I don't know which key to each for. Can anyone please answer my questions?


Given that no one has replied yet, then either no one knows the answer to your questions or they don't understand the question or whatever other reason. Repeatedly bumping the thread isn't going to do much other than annoy some others.

[My Blog] [JavaRanch Journal]
chaitanya karthikk
Ranch Hand

Joined: Sep 15, 2009
Posts: 800

The questions are straight forward. Can you please tell me you understood or not. Or I will create individual questions or I will explain the question again in the same thread.

How can I know whether someone is able to understand my question or not/don't know what I am asking/not interested in answering.
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 9930
    
159

chaitanya karthikk wrote:The questions are straight forward. Can you please tell me you understood or not.

I have no knowledge of GWT.


chaitanya karthikk wrote:
How can I know whether someone is able to understand my question or not/don't know what I am asking/not interested in answering.

Sometimes others might ask for clarifications if they don't understand the question. But that doesn't happen always. That's how volunteer driven forums are. It's ultimately upto them to decide whether or not they want to answer any questions.
chaitanya karthikk
Ranch Hand

Joined: Sep 15, 2009
Posts: 800

Okay Mr. Jai, I think I will have to raise individual threads. Thank you.
Jinal Prakas Shah
Ranch Hand

Joined: Jun 20, 2012
Posts: 39
It's simple. so that it can have a generic object created rather than a specific class object. You can use it for all further uses.
Jinal Prakas Shah
Ranch Hand

Joined: Jun 20, 2012
Posts: 39
This design pattern is RPC(Remote Procedure Call).
chaitanya karthikk
Ranch Hand

Joined: Sep 15, 2009
Posts: 800

Thank you Mr. Jinal
Jinal Prakas Shah
Ranch Hand

Joined: Jun 20, 2012
Posts: 39
No problem Mr. Chaitanya glad I could help.

Regards
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Why is it I have to supply interface not the implementation to GWT.create()?
 
Similar Threads
Abstract methods
NX: Locking and Unlocking and Sun's Must Conditions
Need to work with more windows.
Interface Methods
Interfaces Question(s)