Package org.mozilla.javascript
Class ImporterTopLevel
- java.lang.Object
- 
- org.mozilla.javascript.ScriptableObject
- 
- org.mozilla.javascript.IdScriptableObject
- 
- org.mozilla.javascript.TopLevel
- 
- org.mozilla.javascript.ImporterTopLevel
 
 
 
 
- 
- All Implemented Interfaces:
- java.io.Serializable,- ConstProperties,- DebuggableObject,- IdFunctionCall,- Scriptable,- SymbolScriptable
 - Direct Known Subclasses:
- Global
 
 public class ImporterTopLevel extends TopLevel Class ImporterTopLevelThis 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() []- See Also:
- Serialized Form
 
- 
- 
Nested Class Summary- 
Nested classes/interfaces inherited from class org.mozilla.javascript.TopLevelTopLevel.Builtins
 - 
Nested classes/interfaces inherited from class org.mozilla.javascript.ScriptableObjectScriptableObject.KeyComparator
 
- 
 - 
Field Summary- 
Fields inherited from class org.mozilla.javascript.ScriptableObjectCONST, DONTENUM, EMPTY, PERMANENT, READONLY, UNINITIALIZED_CONST
 - 
Fields inherited from interface org.mozilla.javascript.ScriptableNOT_FOUND
 
- 
 - 
Constructor SummaryConstructors Constructor Description ImporterTopLevel()ImporterTopLevel(Context cx)ImporterTopLevel(Context cx, boolean sealed)
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description java.lang.ObjectexecIdCall(IdFunctionObject f, Context cx, Scriptable scope, Scriptable thisObj, java.lang.Object[] args)'thisObj' will be null if invoked as constructor, in which case * instance of Scriptable should be returned.protected intfindPrototypeId(java.lang.String s)java.lang.Objectget(java.lang.String name, Scriptable start)Returns the value of the named property or NOT_FOUND.java.lang.StringgetClassName()Return the name of the class.booleanhas(java.lang.String name, Scriptable start)Returns true if the named property is defined.voidimportPackage(Context cx, Scriptable thisObj, java.lang.Object[] args, Function funObj)Deprecated.Kept only for compatibility.static voidinit(Context cx, Scriptable scope, boolean sealed)protected voidinitPrototypeId(int id)voidinitStandardObjects(Context cx, boolean sealed)- 
Methods inherited from class org.mozilla.javascript.TopLevelcacheBuiltins, getBuiltinCtor, getBuiltinCtor, getBuiltinPrototype, getBuiltinPrototype
 - 
Methods inherited from class org.mozilla.javascript.IdScriptableObjectactivatePrototypeMap, addIdFunctionProperty, defaultGet, defaultHas, defaultPut, defineOwnProperty, delete, delete, ensureType, exportAsJSClass, fillConstructorProperties, findInstanceIdInfo, findInstanceIdInfo, findPrototypeId, get, getAttributes, getAttributes, getInstanceIdName, getInstanceIdValue, getMaxInstanceId, getOwnPropertyDescriptor, has, hasPrototypeMap, initPrototypeConstructor, initPrototypeMethod, initPrototypeMethod, initPrototypeMethod, initPrototypeValue, initPrototypeValue, instanceIdInfo, put, put, setAttributes, setInstanceIdAttributes, setInstanceIdValue
 - 
Methods inherited from class org.mozilla.javascript.ScriptableObjectapplyDescriptorToAttributeBitset, associateValue, avoidObjectDetection, buildDataDescriptor, callMethod, callMethod, checkPropertyChange, checkPropertyDefinition, defineClass, defineClass, defineClass, defineConst, defineConstProperty, defineFunctionProperties, defineOwnProperties, defineOwnProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, delete, deleteProperty, deleteProperty, ensureScriptable, ensureScriptableObject, ensureSymbolScriptable, equivalentValues, get, get, getAllIds, getArrayPrototype, getAssociatedValue, getAttributes, getAttributes, getAttributes, getClassPrototype, getDefaultValue, getDefaultValue, getExternalArrayData, getExternalArrayLength, getFunctionPrototype, getGeneratorFunctionPrototype, getGetterOrSetter, getGetterOrSetter, getIds, getObjectPrototype, getParentScope, getProperty, getProperty, getProperty, getPropertyIds, getPrototype, getTopLevelScope, getTopScopeValue, getTypedProperty, getTypedProperty, getTypeOf, has, hasInstance, hasProperty, hasProperty, hasProperty, isAccessorDescriptor, isConst, isDataDescriptor, isEmpty, isExtensible, isFalse, isGenericDescriptor, isGetterOrSetter, isSealed, isTrue, preventExtensions, put, putConst, putConstProperty, putProperty, putProperty, putProperty, querySlot, redefineProperty, sameValue, sealObject, setAttributes, setAttributes, setAttributes, setAttributes, setCommonDescriptorProperties, setExternalArrayData, setGetterOrSetter, setParentScope, setPrototype, size
 
- 
 
- 
- 
- 
Method Detail- 
getClassNamepublic java.lang.String getClassName() Description copied from class:ScriptableObjectReturn the name of the class.This is typically the same name as the constructor. Classes extending ScriptableObject must implement this abstract method. - Specified by:
- getClassNamein interface- Scriptable
- Overrides:
- getClassNamein class- TopLevel
 
 - 
initpublic static void init(Context cx, Scriptable scope, boolean sealed) 
 - 
initStandardObjectspublic void initStandardObjects(Context cx, boolean sealed) 
 - 
haspublic boolean has(java.lang.String name, Scriptable start)Description copied from class:ScriptableObjectReturns true if the named property is defined.- Specified by:
- hasin interface- Scriptable
- Overrides:
- hasin class- IdScriptableObject
- Parameters:
- name- the name of the property
- start- the object in which the lookup began
- Returns:
- true if and only if the property was found in the object
- See Also:
- Scriptable.get(String, Scriptable),- ScriptableObject.getProperty(Scriptable, String)
 
 - 
getpublic java.lang.Object get(java.lang.String name, Scriptable start)Description copied from class:ScriptableObjectReturns the value of the named property or NOT_FOUND.If the property was created using defineProperty, the appropriate getter method is called. - Specified by:
- getin interface- Scriptable
- Overrides:
- getin class- IdScriptableObject
- Parameters:
- name- the name of the property
- start- the object in which the lookup began
- Returns:
- the value of the property (may be null), or NOT_FOUND
- See Also:
- Context.getUndefinedValue()
 
 - 
importPackage@Deprecated public void importPackage(Context cx, Scriptable thisObj, java.lang.Object[] args, Function funObj) Deprecated.Kept only for compatibility.
 - 
initPrototypeIdprotected void initPrototypeId(int id) - Overrides:
- initPrototypeIdin class- IdScriptableObject
 
 - 
execIdCallpublic java.lang.Object execIdCall(IdFunctionObject f, Context cx, Scriptable scope, Scriptable thisObj, java.lang.Object[] args) Description copied from class:IdScriptableObject'thisObj' will be null if invoked as constructor, in which case * instance of Scriptable should be returned.- Specified by:
- execIdCallin interface- IdFunctionCall
- Overrides:
- execIdCallin class- IdScriptableObject
 
 - 
findPrototypeIdprotected int findPrototypeId(java.lang.String s) - Overrides:
- findPrototypeIdin class- IdScriptableObject
 
 
- 
 
-