Package org.mozilla.javascript
Class JavaAdapter
- java.lang.Object
-
- org.mozilla.javascript.JavaAdapter
-
- All Implemented Interfaces:
IdFunctionCall
public final class JavaAdapter extends 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 ObjectcallMethod(ContextFactory factory, Scriptable thisObj, Function f, Object[] args, long argsToWrap)Utility method which dynamically binds a Context to the current thread, if none already exists.static ObjectconvertResult(Object result, Class<?> c)static byte[]createAdapterCode(ObjToIntMap functionNames, String adapterName, Class<?> superClass, Class<?>[] interfaces, String scriptClassName)static ScriptablecreateAdapterWrapper(Scriptable obj, Object adapter)ObjectexecIdCall(IdFunctionObject f, Context cx, Scriptable scope, Scriptable thisObj, Object[] args)'thisObj' will be null if invoked as constructor, in which case instance of Scriptable should be returnedstatic ObjectgetAdapterSelf(Class<?> adapterClass, Object adapter)static FunctiongetFunction(Scriptable obj, String functionName)static voidinit(Context cx, Scriptable scope, boolean sealed)static ObjectreadAdapterObject(Scriptable self, ObjectInputStream in)static ScriptablerunScript(Script script)static voidwriteAdapterObject(Object javaObject, ObjectOutputStream out)
-
-
-
Method Detail
-
init
public static void init(Context cx, Scriptable scope, boolean sealed)
-
execIdCall
public Object execIdCall(IdFunctionObject f, Context cx, Scriptable scope, Scriptable thisObj, 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
-
createAdapterWrapper
public static Scriptable createAdapterWrapper(Scriptable obj, Object adapter)
-
getAdapterSelf
public static Object getAdapterSelf(Class<?> adapterClass, Object adapter) throws NoSuchFieldException, IllegalAccessException
-
writeAdapterObject
public static void writeAdapterObject(Object javaObject, ObjectOutputStream out) throws IOException
- Throws:
IOException
-
readAdapterObject
public static Object readAdapterObject(Scriptable self, ObjectInputStream in) throws IOException, ClassNotFoundException
- Throws:
IOExceptionClassNotFoundException
-
createAdapterCode
public static byte[] createAdapterCode(ObjToIntMap functionNames, String adapterName, Class<?> superClass, Class<?>[] interfaces, String scriptClassName)
-
getFunction
public static Function getFunction(Scriptable obj, String functionName)
-
callMethod
public static Object callMethod(ContextFactory factory, Scriptable thisObj, Function f, 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)
-
-