org.mozilla.javascript

Class ImporterTopLevel

Implemented Interfaces:
ConstProperties, DebuggableObject, IdFunctionCall, Scriptable, Serializable

public class ImporterTopLevel
extends IdScriptableObject

Class ImporterTopLevel This class defines a ScriptableObject that can be instantiated as a top-level ("global") object to provide functionality similar to Java's "import" statement.

This class can be used to create a top-level scope using the following code:

  Scriptable scope = new ImporterTopLevel(cx);
 
Then JavaScript code will have access to the following methods: The following code from the shell illustrates this use:
 js> importClass(java.io.File)
 js> f = new File('help.txt')
 help.txt
 js> importPackage(java.util)
 js> v = new Vector()
 []
Author:
Norris Boyd

Field Summary

Fields inherited from class org.mozilla.javascript.ScriptableObject

CONST, DONTENUM, EMPTY, PERMANENT, READONLY, UNINITIALIZED_CONST

Fields inherited from interface org.mozilla.javascript.Scriptable

NOT_FOUND

Constructor Summary

ImporterTopLevel()
ImporterTopLevel(Context cx)
ImporterTopLevel(Context cx, boolean sealed)

Method Summary

@Override
Object execIdCall(IdFunctionObject f, Context cx, Scriptable scope, Scriptable thisObj, Object[] args)
@Override
Object get(String name, Scriptable start)
@Override
String getClassName()
@Override
boolean has(String name, Scriptable start)
void
importPackage(Context cx, Scriptable thisObj, Object[] args, Function funObj)
Deprecated. Kept only for compatibility.
static void
init(Context cx, Scriptable scope, boolean sealed)
void
initStandardObjects(Context cx, boolean sealed)
protected @Override
int findPrototypeId(String s)
protected @Override
void initPrototypeId(int id)

Methods inherited from class org.mozilla.javascript.IdScriptableObject

Object get, activatePrototypeMap, addIdFunctionProperty, boolean has, defaultGet, defaultPut, execIdCall, exportAsJSClass, fillConstructorProperties, findInstanceIdInfo, findPrototypeId, getInstanceIdName, getInstanceIdValue, getMaxInstanceId, hasPrototypeMap, incompatibleCallError, initPrototypeConstructor, initPrototypeId, initPrototypeMethod, initPrototypeValue, instanceIdInfo, int getAttributes, setInstanceIdValue, void delete, void put, void setAttributes

Methods inherited from class org.mozilla.javascript.ScriptableObject

associateValue, avoidObjectDetection, callMethod, callMethod, defineConst, defineConstProperty, defineFunctionProperties, defineProperty, defineProperty, defineProperty, defineProperty, delete, delete, deleteProperty, deleteProperty, equivalentValues, extends Scriptable> String defineClass, extends Scriptable> void defineClass, extends Scriptable> void defineClass, get, get, getAllIds, getAssociatedValue, getAttributes, getAttributes, getAttributes, getAttributes, getClassName, getClassPrototype, getDefaultValue, getDefaultValue, getFunctionPrototype, getGetterOrSetter, getIds, getObjectPrototype, getParentScope, getProperty, getProperty, getPropertyIds, getPrototype, getTopLevelScope, getTopScopeValue, has, has, hasInstance, hasProperty, hasProperty, isConst, isGetterOrSetter, isSealed, put, put, putConst, putConstProperty, putProperty, putProperty, redefineProperty, sealObject, setAttributes, setAttributes, setAttributes, setAttributes, setGetterOrSetter, setParentScope, setPrototype

Constructor Details

ImporterTopLevel

public ImporterTopLevel()

ImporterTopLevel

public ImporterTopLevel(Context cx)

ImporterTopLevel

public ImporterTopLevel(Context cx,
                        boolean sealed)

Method Details

Object execIdCall

public @Override Object execIdCall(IdFunctionObject f,
                                   Context cx,
                                   Scriptable scope,
                                   Scriptable thisObj,
                                   Object[] args)

Object get

public @Override Object get(String name,
                            Scriptable start)
Overrides:
Object get in interface IdScriptableObject

String getClassName

public @Override String getClassName()

boolean has

public @Override boolean has(String name,
                             Scriptable start)
Overrides:
boolean has in interface IdScriptableObject

importPackage

public void importPackage(Context cx,
                          Scriptable thisObj,
                          Object[] args,
                          Function funObj)

Deprecated. Kept only for compatibility.


init

public static void init(Context cx,
                        Scriptable scope,
                        boolean sealed)

initStandardObjects

public void initStandardObjects(Context cx,
                                boolean sealed)

int findPrototypeId

protected @Override int findPrototypeId(String s)

void initPrototypeId

protected @Override void initPrototypeId(int id)