If value is an instance of String, Number, Boolean, Function or Scriptable, it is returned as it and will be treated as the corresponding JavaScript type of string, number, boolean, function and object.
Note that for Number instances during any arithmetic operation in JavaScript the engine will always use the result of Number.doubleValue() resulting in a precision loss if the number can not fit into double.
If value is an instance of Character, it will be converted to string of length 1 and its JavaScript type will be string.
The rest of values will be wrapped as LiveConnect objects by calling {@link WrapFactory#wrap(Context cx,Scriptable scope,Object obj,Class staticType)} as in:
Context cx = Context.getCurrentContext(); return cx.getWrapFactory().wrap(cx, scope, value, null);@param value any Java object @param scope top scope object @return value suitable to pass to any API that takes JavaScript values.
|
|
|
|
|
|