public class JavaClassHierarchySetupUtil extends Object
Constructor and Description |
---|
JavaClassHierarchySetupUtil() |
Modifier and Type | Method and Description |
---|---|
static JavaScriptObject |
createSubclassPrototype(JavaScriptObject superTypeId)
Create a subclass prototype.
|
static JavaScriptObject |
defineClass(JavaScriptObject typeId,
JavaScriptObject superTypeId,
JavaScriptObject castableTypeMap)
If not already created it creates the prototype for the class and stores it in
prototypesByTypeId . |
static JavaScriptObject |
defineClassWithPrototype(int typeId,
JavaScriptObject jsSuperClass,
JavaScriptObject castableTypeMap)
Like defineClass() but second parameter is a native JS prototype reference.
|
static JavaScriptObject |
getClassPrototype(JavaScriptObject typeId)
Retrieves the prototype for a type if it exists, null otherwise.
|
static JavaScriptObject |
makeBridgeMethod(JavaScriptObject methodRef,
boolean returnsLong,
boolean[] longParams)
Create a function that invokes the specified method reference.
|
static void |
modernizeBrowser()
Do polyfills for all methods expected in a modern browser.
|
static JavaScriptObject |
provide(JavaScriptObject namespace)
Creates a JS namespace to attach exported classes to.
|
static boolean |
trampolineBridgeMethod(Object o,
Object bridgeRef,
Object nonbridgeRef)
If the parameter o is a Javascript object, return the bridge method reference,
otherwise return the nonbridge reference.
|
public static JavaScriptObject defineClass(JavaScriptObject typeId, JavaScriptObject superTypeId, JavaScriptObject castableTypeMap)
prototypesByTypeId
. If superTypeId 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 superSeed is not null, it is assumed that defineClass for the supertype
has already been called.public static JavaScriptObject defineClassWithPrototype(int typeId, JavaScriptObject jsSuperClass, JavaScriptObject castableTypeMap)
public static JavaScriptObject createSubclassPrototype(JavaScriptObject superTypeId)
public static JavaScriptObject provide(JavaScriptObject namespace)
namespace
- a dotted js namespace stringpublic static JavaScriptObject makeBridgeMethod(JavaScriptObject methodRef, boolean returnsLong, boolean[] longParams)
public static boolean trampolineBridgeMethod(Object o, Object bridgeRef, Object nonbridgeRef)
o
- an instance object we want to invoke a method onbridgeRef
- a reference to an exported, bridgereference or jstype methodnonbridgeRef
- the internal reference to Java obfuscated methodpublic static void modernizeBrowser()
public static JavaScriptObject getClassPrototype(JavaScriptObject typeId)
Copyright © 2018. All rights reserved.