Making javaToJS static to match the rest of API

This commit is contained in:
igor%mir2.org 2004-03-01 19:19:47 +00:00
Родитель fba23f9319
Коммит 7cc3ebfd9c
1 изменённых файлов: 5 добавлений и 4 удалений

Просмотреть файл

@ -1427,15 +1427,15 @@ public class Context
* by calling {@link WrapFactory#wrap(Context cx, Scriptable scope,
* Object obj, Class staticType)} as in:
* <pre>
* return contextInstance.getWrapFactory().wrap(contextInstance, scope,
* value, null);
* Context cx = Context.getCurrentContext();
* return cx.getWrapFactory().wrap(cx, scope, value, null);
* </pre>
*
* @param value any Java object
* @param scope top scope object
* @return value suitable to pass to any API that takes JavaScript values.
*/
public Object javaToJS(Object value, Scriptable scope)
public static Object javaToJS(Object value, Scriptable scope)
{
if (value instanceof String || value instanceof Number
|| value instanceof Boolean || value instanceof Scriptable)
@ -1444,7 +1444,8 @@ public class Context
} else if (value instanceof Character) {
return String.valueOf(((Character)value).charValue());
} else {
return getWrapFactory().wrap(this, scope, value, null);
Context cx = Context.getContext();
return cx.getWrapFactory().wrap(cx, scope, value, null);
}
}