I resolved it myself. Two different ways. This is way too cool!!!! public static int computeLoanInterest(final int amt, final float rate, final int term) { return (int) (amt * rate * term); }
public static void getConnection2(final JavaScriptObject jso) { Connection.get(new Callback<Connection>() { public void onComplete(final Connection connection) { invoke(jso, connection); } }); } public static native void invoke(final JavaScriptObject jso, final Object parameter) /*-{ jso(parameter); }-*/; public static void getConnection(final String instance) { Connection.get(new Callback<Connection>() { public void onComplete(final Connection connection) { connected(instance, connection); } }); } public static native void connected(final String instance, final Connection connection) /*-{ $wnd.onConnect(instance, connection); }-*/; public static native void exportStaticMethod() /*-{ $wnd.computeLoanInterest = $entry(@com.mhsystems.rsmapiproxy.client.SomeTestClass::computeLoanInterest(IFI)); $wnd.getConnection = $entry(@com.mhsystems.rsmapiproxy.client.SomeTestClass::getConnection(Ljava/ lang/String;)); $wnd.getConnection2 = $entry(@com.mhsystems.rsmapiproxy.client.SomeTestClass::getConnection2(Lcom/ google/gwt/core/client/JavaScriptObject;)); }-*/; On Mar 5, 11:53 pm, babakm <bmo...@gmail.com> wrote: > I built an API in GWT for accessing a series of complex services. I > wanted to do tons of client side processing and I chose GWT (been > doing GWT for years now). However, my users will be using Javascript. > I can easily call GWT from Javascript. No problem. I set up a routine > I run as soon as my EntryPoint is invoked, and it runs some Javascript > (just as explained in GWT docs). The problem is that many (more like > ALL) of my objects and methods use callbacks (everything is async). > And in many cases, they take Java generics (good old C++ style > templates). For instance: > > public static void getConnection(final Callback<Connection> callback) > { > Connection.get(callback); > > } > > I want to register this method using: > > public static native void exportStaticMethod() /*-{ > $wnd.computeLoanInterest = > $entry(@com.mhsystems.rsmapiproxy.client.SomeTestClass::computeLoanInterest > (IFI)); > $wnd.getConnection = > $entry(@com.mhsystems.rsmapiproxy.client.SomeTestClass::getConnection(Lcom/ > mhsystems/rsmapiproxy/api/Callback)); > > }-*/; > > How do I do that? The first one (computeLoanInterest) works. The > second one, getConnection, does not. Callback<T> is an interface (not > an object). Could that be the problem? I don't know how to declare the > generic Connection here. If that is not possible, I can write specific > objects but at the end of the day, I need the Javascript code to pass > in a Javascript callback that is called by the GWT code when it is all > said and done. > > Cheerz! -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to google-web-toolkit@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.