Package org.mozilla.javascript
Class JavaAdapter
- java.lang.Object
-
- org.mozilla.javascript.JavaAdapter
-
- All Implemented Interfaces:
IdFunctionCall
public final class JavaAdapter extends java.lang.Object implements IdFunctionCall
-
-
Constructor Summary
Constructors Constructor Description JavaAdapter()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static java.lang.ObjectcallMethod(ContextFactory factory, Scriptable thisObj, Function f, java.lang.Object[] args, long argsToWrap)Utility method which dynamically binds a Context to the current thread, if none already exists.static java.lang.ObjectconvertResult(java.lang.Object result, java.lang.Class<?> c)static byte[]createAdapterCode(ObjToIntMap functionNames, java.lang.String adapterName, java.lang.Class<?> superClass, java.lang.Class<?>[] interfaces, java.lang.String scriptClassName)static ScriptablecreateAdapterWrapper(Scriptable obj, java.lang.Object adapter)java.lang.ObjectexecIdCall(IdFunctionObject f, Context cx, Scriptable scope, Scriptable thisObj, java.lang.Object[] args)'thisObj' will be null if invoked as constructor, in which case instance of Scriptable should be returnedstatic java.lang.ObjectgetAdapterSelf(java.lang.Class<?> adapterClass, java.lang.Object adapter)static FunctiongetFunction(Scriptable obj, java.lang.String functionName)static voidinit(Context cx, Scriptable scope, boolean sealed)static java.lang.ObjectreadAdapterObject(Scriptable self, java.io.ObjectInputStream in)static ScriptablerunScript(Script script)static voidwriteAdapterObject(java.lang.Object javaObject, java.io.ObjectOutputStream out)
-
-
-
Method Detail
-
init
public static void init(Context cx, Scriptable scope, boolean sealed)
-
execIdCall
public java.lang.Object execIdCall(IdFunctionObject f, Context cx, Scriptable scope, Scriptable thisObj, java.lang.Object[] args)
Description copied from interface:IdFunctionCall'thisObj' will be null if invoked as constructor, in which case instance of Scriptable should be returned- Specified by:
execIdCallin interfaceIdFunctionCall
-
convertResult
public static java.lang.Object convertResult(java.lang.Object result, java.lang.Class<?> c)
-
createAdapterWrapper
public static Scriptable createAdapterWrapper(Scriptable obj, java.lang.Object adapter)
-
getAdapterSelf
public static java.lang.Object getAdapterSelf(java.lang.Class<?> adapterClass, java.lang.Object adapter) throws java.lang.NoSuchFieldException, java.lang.IllegalAccessException- Throws:
java.lang.NoSuchFieldExceptionjava.lang.IllegalAccessException
-
writeAdapterObject
public static void writeAdapterObject(java.lang.Object javaObject, java.io.ObjectOutputStream out) throws java.io.IOException- Throws:
java.io.IOException
-
readAdapterObject
public static java.lang.Object readAdapterObject(Scriptable self, java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundException
- Throws:
java.io.IOExceptionjava.lang.ClassNotFoundException
-
createAdapterCode
public static byte[] createAdapterCode(ObjToIntMap functionNames, java.lang.String adapterName, java.lang.Class<?> superClass, java.lang.Class<?>[] interfaces, java.lang.String scriptClassName)
-
getFunction
public static Function getFunction(Scriptable obj, java.lang.String functionName)
-
callMethod
public static java.lang.Object callMethod(ContextFactory factory, Scriptable thisObj, Function f, java.lang.Object[] args, long argsToWrap)
Utility method which dynamically binds a Context to the current thread, if none already exists.
-
runScript
public static Scriptable runScript(Script script)
-
-