# HG changeset patch # User Jaroslav Tulach # Date 1449042271 -3600 # Node ID 2f6f1d20fa7a865b52955cc2d01544c4844db93f # Parent c918924ad3c58fc227d8348df901c0852ce7f888 Improving documentation of the @JavaScriptBody's callback mechanism diff -r c918924ad3c5 -r 2f6f1d20fa7a boot/src/main/java/net/java/html/js/package.html --- a/boot/src/main/java/net/java/html/js/package.html Thu Nov 26 20:59:51 2015 +0100 +++ b/boot/src/main/java/net/java/html/js/package.html Wed Dec 02 08:44:31 2015 +0100 @@ -113,9 +113,9 @@ function mul and use it.

Real code tip: - this + this is the way - the knockout.js library + the knockout.js library is included in its ko4j library.

Callback to Java

@@ -152,13 +152,88 @@

Please note that to turn the special Java callback syntax on, one needs to set the {@link net.java.html.js.JavaScriptBody#javacall()} - attribute to true. + attribute to true. The callback syntax consists of + following parts:

- Editing hint: there is an associated annotation processor +
[instance.]@classname::methodname(signature)(arguments)
+ + +

Here is the JNI type signatures table + one can use to convert + Java parameters to JVM's internal letter based + representation:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Type SignatureJava Type
Zboolean
Bbyte
Cchar
Sshort
Iint
Jlong
Ffloat
Ddouble
L fully-qualified-class ;fully-qualified-class
[ typetype[]
+

+ Editing hint: The callback syntax may seem complicated at + first, however there is an associated annotation processor that checks the syntax and verifies the referenced class and - method of the right signature exist. If they do not, the - compilation fails. Thus don't despair seeing the syntax, you'll get early - warnings when there is a typo. + method with the requested signature exist. If it does not, the + compilation fails offering correct alternatives. + Thus don't despair seeing the syntax, make sure you get the + fully qualified name of the callback class right. + You'll get warning and help + if there is a typo in the specified signature then - + during compilation of your code.

Overloaded Methods