java.lang.Object
org.htmlunit.corejs.javascript.SlotMapOwner<VarScope>
org.htmlunit.corejs.javascript.ScopeObject
org.htmlunit.corejs.javascript.TopLevel
org.htmlunit.corejs.javascript.ImporterTopLevel
- All Implemented Interfaces:
Serializable,ConstProperties<VarScope>,PropHolder<VarScope>,VarScope
- Direct Known Subclasses:
Global
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:
- importClass - will "import" a class by making its unqualified name available as a property of the top-level scope
- importPackage - will "import" all the classes of the package by searching for unqualified names as classes qualified by the given package.
js> importClass(java.io.File)
js> f = new File('help.txt')
help.txt
js> importPackage(java.util)
js> v = new Vector()
[]
- Author:
- Norris Boyd
- See Also:
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class org.htmlunit.corejs.javascript.TopLevel
TopLevel.Builtins, TopLevel.GlobalThis -
Field Summary
Fields inherited from class org.htmlunit.corejs.javascript.SlotMapOwner
isSealed -
Constructor Summary
ConstructorsConstructorDescriptionImporterTopLevel(boolean topLevel) ImporterTopLevel(Context cx, boolean sealed) -
Method Summary
Modifier and TypeMethodDescriptionstatic TopLevelcreateIsolate(Context cx, TopLevel parent) voidimportPackage(Context cx, Scriptable thisObj, Object[] args, Function funObj) Deprecated.Kept only for compatibility.static voidstatic voidvoidinitStandardObjects(Context cx, boolean sealed) Methods inherited from class org.htmlunit.corejs.javascript.TopLevel
cacheBuiltins, cacheBuiltins, copyBuiltins, createIsolate, createIsolate, createIsolateCustomPrototypeChain, defineConst, defineFunctionProperties, defineProperty, delete, get, getAttributes, getBuiltinCtor, getBuiltinCtor, getBuiltinPrototype, getBuiltinPrototype, getBuiltinPrototype, has, isConst, put, putConst, sealObject, setAttributesMethods inherited from class org.htmlunit.corejs.javascript.ScopeObject
defineProperty, delete, delete, get, get, getParentScope, getThis, has, has, put, put, putOwnProperty, putOwnProperty, putOwnProperty, setAttributesMethods inherited from class org.htmlunit.corejs.javascript.SlotMapOwner
associateValue, checkNotSealed, copyAssociatedValue, createSlotMap, createSlotMap, getAssociatedValue, getAttributes, getAttributes, getAttributes, getAttributes, getIds, isSealed, readMaps, setAttributes, setAttributes, setAttributes, writeMapsMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.htmlunit.corejs.javascript.PropHolder
getIdsMethods inherited from interface org.htmlunit.corejs.javascript.VarScope
copyScope, getAncestor, isNestedScope
-
Constructor Details
-
ImporterTopLevel
public ImporterTopLevel() -
ImporterTopLevel
public ImporterTopLevel(boolean topLevel) -
ImporterTopLevel
-
ImporterTopLevel
-
-
Method Details
-
init
-
init
-
initStandardObjects
-
importPackage
@Deprecated public void importPackage(Context cx, Scriptable thisObj, Object[] args, Function funObj) Deprecated.Kept only for compatibility. -
getGlobalThis
- Overrides:
getGlobalThisin classTopLevel
-
createIsolate
-