Ok just played a bit and its like the following:
With the above you can do
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.
-- @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;
}
}
-- 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 google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment