So, here is a little cheat sheet for those of you looking for the GWT JSNI type codes. These are, of course, the same codes that can be found in the JNI reference.
| Native Type | Java Language Type | Description | Type signature |
|---|---|---|---|
| unsigned char | jboolean | unsigned 8 bits | Z |
| signed char | jbyte | signed 8 bits | B |
| unsigned short | jchar | unsigned 16 bits | C |
| short | jshort | signed 16 bits | S |
| long | jint | signed 32 bits | I |
long long __int64 | jlong | signed 64 bits | J |
| float | jfloat | 32 bits | F |
| double | jdouble | 64 bits | D |
Table taken from Wikipedia, 5/7/2011
In addition to the primitive types, any object can be referenced using its fully qualified name like this:
LFully.Qualified.Name;
For example, to access a string, you use: Ljava.lang.String;
To reference an array of the same type, prepend [ like this:
[Ljava.langString;
So that's my quick cheat sheet. Here are a couple of additional references that help:
Coding Basics - Javascript Native Interface (JSNI)
| JDK 6 Java Native Interface-related APIs & Developer Guides |

No comments:
Post a Comment