public class Runtime extends Object
Constructor and Description |
---|
Runtime() |
Modifier and Type | Method and Description |
---|---|
static void |
bootstrap()
Called at the beginning to setup required structures before any of the classes is defined.
|
static void |
copyObjectProperties(JavaScriptObject from,
JavaScriptObject to) |
static void |
defineClass(JavaScriptObject typeId,
JavaScriptObject superTypeIdOrPrototype,
JavaScriptObject castableTypeMap)
If not already created it creates the prototype for the class and stores it in
prototypesByTypeId . |
static JavaScriptObject |
getClassPrototype(JavaScriptObject typeId)
Retrieves the prototype for a type if it exists, null otherwise.
|
static JavaScriptObject |
makeLambdaFunction(JavaScriptObject samMethod,
JavaScriptObject ctor,
JavaScriptObject ctorArguments)
Create a function that applies the specified samMethod on itself, and whose __proto__ points to
instance . |
static JavaScriptObject |
provide(JavaScriptObject namespace,
JavaScriptObject optCtor)
Creates a JS namespace to attach exported classes to.
|
static String |
toString(Object object) |
public static void defineClass(JavaScriptObject typeId, JavaScriptObject superTypeIdOrPrototype, JavaScriptObject castableTypeMap)
prototypesByTypeId
. If superTypeIdOrPrototype is null, it means that the class being
defined is the topmost class (i.e. java.lang.Object) and creates an empty prototype for it.
Otherwise it creates the prototype for the class by calling createSubclassPrototype()
.
It also assigns the castable type map and sets the constructors prototype field to the
current prototype.
Finally adds the class literal if it was created before the call to defineClass
.
Class literals might be created before the call to defineClass
if they are in separate
code-split fragments. In that case Class.createFor* methods will have created a placeholder and
stored in prototypesByTypeId
the class literal.
As a prerequisite if superTypeIdOrPrototype is not null, it is assumed that defineClass for the supertype has already been called.
This method has the effect of assigning the newly created prototype to the global temp variable '_'.
public static void copyObjectProperties(JavaScriptObject from, JavaScriptObject to)
public static JavaScriptObject provide(JavaScriptObject namespace, JavaScriptObject optCtor)
namespace
- a dotted js namespace stringpublic static JavaScriptObject makeLambdaFunction(JavaScriptObject samMethod, JavaScriptObject ctor, JavaScriptObject ctorArguments)
instance
.public static void bootstrap()
public static JavaScriptObject getClassPrototype(JavaScriptObject typeId)
Copyright © 2018. All rights reserved.