Ok just played a bit and its like the following:

@JsExport // value attribute is ignored here, probably because it acts as a 
shortcut to apply @JsExport to any static member
@JsType // required so you also have exported instance members (your 
sayHello method) and not just static members
@JsNamespace("poc") // the default namespace, should probably go in a 
package-info.java file
public class JsHello {
 public String sayHello(String name) {
   return "Hello " + name;
 }
}

With the above you can do

  
var hello = new poc.JsHello(); hello.sayHello("World");


If you want to rename JsHello to Hello you do

@JsExport
@JsType
public class JsHello {
 
 @JsExport("poc.Hello") // replaces any @JsNamespace default value so you 
need to add namespace here
 public JsHello() {}
 
 public String sayHello(String name) {
   return "Hello " + name;
 }
}


I would try to avoid renaming, as you must repeat the namespace in 
@JsExport. Just name your classes correctly and stick with the first 
example with @JsNamespace in a package-info.java file.

-- J.

-- 
You received this message because you are subscribed to the Google Groups "GWT 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

Reply via email to