org.mozilla.javascript
Class JavaAdapter
java.lang.Object
org.mozilla.javascript.JavaAdapter
- All Implemented Interfaces:
- IdFunctionCall
public final class JavaAdapter
- extends Object
- implements IdFunctionCall
Method Summary |
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. |
static Object |
convertResult(Object result,
Class<?> c)
|
static byte[] |
createAdapterCode(ObjToIntMap functionNames,
String adapterName,
Class<?> superClass,
Class<?>[] interfaces,
String scriptClassName)
|
static Scriptable |
createAdapterWrapper(Scriptable obj,
Object adapter)
|
Object |
execIdCall(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 returned |
static Object |
getAdapterSelf(Class<?> adapterClass,
Object adapter)
|
static Function |
getFunction(Scriptable obj,
String functionName)
|
static void |
init(Context cx,
Scriptable scope,
boolean sealed)
|
static Object |
readAdapterObject(Scriptable self,
ObjectInputStream in)
|
static Scriptable |
runScript(Script script)
|
static void |
writeAdapterObject(Object javaObject,
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 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:
execIdCall
in interface IdFunctionCall
convertResult
public static Object convertResult(Object result,
Class<?> c)
createAdapterWrapper
public static Scriptable createAdapterWrapper(Scriptable obj,
Object adapter)
getAdapterSelf
public static Object getAdapterSelf(Class<?> adapterClass,
Object adapter)
throws NoSuchFieldException,
IllegalAccessException
- 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:
IOException
ClassNotFoundException
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)