
public abstract class ModuleSpace extends Object implements ShellJavaScriptHost
| Modifier and Type | Field and Description |
|---|---|
protected ModuleSpaceHost |
host |
| Modifier | Constructor and Description |
|---|---|
protected |
ModuleSpace(TreeLogger logger,
ModuleSpaceHost host,
String moduleName) |
| Modifier and Type | Method and Description |
|---|---|
protected static RuntimeException |
createJavaScriptException(ClassLoader cl,
Object exception)
Equivalent to
createJavaScriptException(cl, exception, ""). |
protected static RuntimeException |
createJavaScriptException(ClassLoader cl,
Object exception,
String message)
Create a JavaScriptException object.
|
protected String |
createNativeMethodInjector(String jsniSignature,
String[] paramNames,
String js) |
protected abstract void |
createStaticDispatcher(TreeLogger logger)
Create the __defineStatic method.
|
void |
dispose() |
protected abstract JsValue |
doInvoke(String name,
Object jthis,
Class<?>[] types,
Object[] args)
Invokes a native JavaScript function.
|
void |
exceptionCaught(Object exception)
Call this when a JavaScript exception is caught.
|
protected CompilingClassLoader |
getIsolatedClassLoader() |
protected static TreeLogger |
getLogger() |
String |
getModuleName()
Get the module name.
|
protected abstract Object |
getStaticDispatcher()
Injects the magic needed to resolve JSNI references from module-space.
|
protected JsValue |
invokeNative(String name,
Object jthis,
Class<?>[] types,
Object[] args)
Invokes a native JavaScript function.
|
boolean |
invokeNativeBoolean(String name,
Object jthis,
Class<?>[] types,
Object[] args)
Invoke a native JavaScript function that returns a boolean value.
|
byte |
invokeNativeByte(String name,
Object jthis,
Class<?>[] types,
Object[] args)
Invoke a native JavaScript function that returns a byte value.
|
char |
invokeNativeChar(String name,
Object jthis,
Class<?>[] types,
Object[] args)
Invoke a native JavaScript function that returns a character value.
|
double |
invokeNativeDouble(String name,
Object jthis,
Class<?>[] types,
Object[] args)
Invoke a native JavaScript function that returns a double value.
|
float |
invokeNativeFloat(String name,
Object jthis,
Class<?>[] types,
Object[] args)
Invoke a native JavaScript function that returns a float value.
|
int |
invokeNativeInt(String name,
Object jthis,
Class<?>[] types,
Object[] args)
Invoke a native JavaScript function that returns an integer value.
|
long |
invokeNativeLong(String name,
Object jthis,
Class<?>[] types,
Object[] args)
Invoke a native JavaScript function that returns a long value.
|
Object |
invokeNativeObject(String name,
Object jthis,
Class<?>[] types,
Object[] args)
Invoke a native JavaScript function that returns an object value.
|
short |
invokeNativeShort(String name,
Object jthis,
Class<?>[] types,
Object[] args)
Invoke a native JavaScript function that returns a short value.
|
void |
invokeNativeVoid(String name,
Object jthis,
Class<?>[] types,
Object[] args)
Invoke a native JavaScript function that returns no value.
|
protected boolean |
isExceptionSame(Throwable original,
Object exception) |
void |
log(String message,
Throwable e)
Allows client-side code to log to the tree logger.
|
void |
onLoad(TreeLogger logger)
Runs the module's user startup code.
|
protected String |
rebind(String sourceName) |
<T> T |
rebindAndCreate(String requestedClassName)
Resolves a deferred binding request and create the requested object.
|
static void |
setThrownJavaException(Throwable t) |
createNativeMethodsprotected final ModuleSpaceHost host
protected ModuleSpace(TreeLogger logger, ModuleSpaceHost host, String moduleName)
public static void setThrownJavaException(Throwable t)
protected static RuntimeException createJavaScriptException(ClassLoader cl, Object exception)
createJavaScriptException(cl, exception, "").protected static RuntimeException createJavaScriptException(ClassLoader cl, Object exception, String message)
protected static TreeLogger getLogger()
public void dispose()
public void exceptionCaught(Object exception)
ShellJavaScriptHostexceptionCaught in interface ShellJavaScriptHostpublic String getModuleName()
public boolean invokeNativeBoolean(String name, Object jthis, Class<?>[] types, Object[] args) throws Throwable
ShellJavaScriptHostinvokeNativeBoolean in interface ShellJavaScriptHostThrowablepublic byte invokeNativeByte(String name, Object jthis, Class<?>[] types, Object[] args) throws Throwable
ShellJavaScriptHostinvokeNativeByte in interface ShellJavaScriptHostThrowablepublic char invokeNativeChar(String name, Object jthis, Class<?>[] types, Object[] args) throws Throwable
ShellJavaScriptHostinvokeNativeChar in interface ShellJavaScriptHostThrowablepublic double invokeNativeDouble(String name, Object jthis, Class<?>[] types, Object[] args) throws Throwable
ShellJavaScriptHostinvokeNativeDouble in interface ShellJavaScriptHostThrowablepublic float invokeNativeFloat(String name, Object jthis, Class<?>[] types, Object[] args) throws Throwable
ShellJavaScriptHostinvokeNativeFloat in interface ShellJavaScriptHostThrowablepublic int invokeNativeInt(String name, Object jthis, Class<?>[] types, Object[] args) throws Throwable
ShellJavaScriptHostinvokeNativeInt in interface ShellJavaScriptHostThrowablepublic long invokeNativeLong(String name, Object jthis, Class<?>[] types, Object[] args) throws Throwable
ShellJavaScriptHostinvokeNativeLong in interface ShellJavaScriptHostThrowablepublic Object invokeNativeObject(String name, Object jthis, Class<?>[] types, Object[] args) throws Throwable
ShellJavaScriptHostinvokeNativeObject in interface ShellJavaScriptHostThrowablepublic short invokeNativeShort(String name, Object jthis, Class<?>[] types, Object[] args) throws Throwable
ShellJavaScriptHostinvokeNativeShort in interface ShellJavaScriptHostThrowablepublic void invokeNativeVoid(String name, Object jthis, Class<?>[] types, Object[] args) throws Throwable
ShellJavaScriptHostinvokeNativeVoid in interface ShellJavaScriptHostThrowablepublic void log(String message, Throwable e)
log in interface ShellJavaScriptHostpublic final void onLoad(TreeLogger logger) throws UnableToCompleteException
UnableToCompleteExceptionpublic <T> T rebindAndCreate(String requestedClassName) throws UnableToCompleteException
ShellJavaScriptHostrebindAndCreate in interface ShellJavaScriptHostUnableToCompleteExceptionprotected String createNativeMethodInjector(String jsniSignature, String[] paramNames, String js)
protected abstract void createStaticDispatcher(TreeLogger logger)
logger - protected abstract JsValue doInvoke(String name, Object jthis, Class<?>[] types, Object[] args) throws Throwable
name - the name of the function to invokejthis - the function's 'this' contexttypes - the type of each argumentargs - the arguments to be passedThrowableprotected CompilingClassLoader getIsolatedClassLoader()
protected abstract Object getStaticDispatcher()
protected final JsValue invokeNative(String name, Object jthis, Class<?>[] types, Object[] args) throws Throwable
name - the name of the function to invokejthis - the function's 'this' contexttypes - the type of each argumentargs - the arguments to be passedThrowableprotected boolean isExceptionSame(Throwable original, Object exception)
original - the thrown exceptionexception - the caught exceptionprotected String rebind(String sourceName) throws UnableToCompleteException
UnableToCompleteExceptionCopyright © 2018. All rights reserved.