org.mozilla.javascript

Class ImporterTopLevel

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

Constructor Summary
ImporterTopLevel()
ImporterTopLevel(Context cx)
ImporterTopLevel(Context cx, boolean sealed)
Method Summary
ObjectexecIdCall(IdFunctionObject f, Context cx, Scriptable scope, Scriptable thisObj, Object[] args)
protected intfindPrototypeId(String s)
Objectget(String name, Scriptable start)
StringgetClassName()
booleanhas(String name, Scriptable start)
voidimportPackage(Context cx, Scriptable thisObj, Object[] args, Function funObj)
static voidinit(Context cx, Scriptable scope, boolean sealed)
protected voidinitPrototypeId(int id)
voidinitStandardObjects(Context cx, boolean sealed)

Constructor Detail

ImporterTopLevel

public ImporterTopLevel()

ImporterTopLevel

public ImporterTopLevel(Context cx)

ImporterTopLevel

public ImporterTopLevel(Context cx, boolean sealed)

Method Detail

execIdCall

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

findPrototypeId

protected int findPrototypeId(String s)

get

public Object get(String name, Scriptable start)

getClassName

public String getClassName()

has

public boolean has(String name, Scriptable start)

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)

initPrototypeId

protected void initPrototypeId(int id)

initStandardObjects

public void initStandardObjects(Context cx, boolean sealed)