Parameter conversion
JavaScript™ parameters are passed by value (JavaScript™ arrays and objects used as parameters are not modified by the Java™ code).
JavaScript™ | Java™ |
---|---|
Boolean |
Boolean |
byte |
Byte |
short |
Short |
int |
Integer |
long |
Long |
float |
Float |
double |
Double |
Object |
java.util.Map – A temporary HashMap is
created containing all the property name/value pairs. Primitive values
(number, Boolean, string) are converted to a java.lang.String while Java™ objects are left as is. |
char |
java.lang.Character – When
converting, only the first character is extracted. |
undefined |
Not assignable. |
null |
Created as any Java™ object
and assigned the Java™ null value. |
Date |
java.util.Date |
Array |
A temporary Java™ array of the correct type is created and filled by converting all the values in the JavaScript™ array. |
Wrapped Java™ object | Any Java™ object
that is compatible (isAssignableFrom ) passed as is
without conversion |
Java™ return values are passed as follows:
Java™ | JavaScript™ |
---|---|
void |
undefined |
Any number whether primitive or object | number |
java.lang.String |
string |
java.util.Date |
Date |
Array | Not converted |
Other objects | Wrapped and used as is |