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
Method Summary |
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. |
static java.lang.Object |
convertResult(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 Scriptable |
createAdapterWrapper(Scriptable obj,
java.lang.Object adapter)
|
java.lang.Object |
execIdCall(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 returned |
static java.lang.Object |
getAdapterSelf(java.lang.Class<?> adapterClass,
java.lang.Object adapter)
|
static Function |
getFunction(Scriptable obj,
java.lang.String functionName)
|
static void |
init(Context cx,
Scriptable scope,
boolean sealed)
|
static java.lang.Object |
readAdapterObject(Scriptable self,
java.io.ObjectInputStream in)
|
static Scriptable |
runScript(Script script)
|
static void |
writeAdapterObject(java.lang.Object javaObject,
java.io.ObjectOutputStream out)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
JavaAdapter
public JavaAdapter()
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:
execIdCall
in interface IdFunctionCall
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.NoSuchFieldException
java.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.IOException
java.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)