public class ImporterTopLevel extends TopLevel
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:
js> importClass(java.io.File)
js> f = new File('help.txt')
help.txt
js> importPackage(java.util)
js> v = new Vector()
[]
TopLevel.BuiltinsScriptableObject.DescriptorInfo, ScriptableObject.KeyComparator, ScriptableObject.LambdaGetterFunction, ScriptableObject.LambdaSetterFunctionCONST, DONTENUM, EMPTY, PERMANENT, READONLY, UNINITIALIZED_CONSTNOT_FOUND| Constructor and Description |
|---|
ImporterTopLevel() |
ImporterTopLevel(Context cx) |
ImporterTopLevel(Context cx,
boolean sealed) |
| Modifier and Type | Method and Description |
|---|---|
Object |
get(String name,
Scriptable start)
Returns the value of the named property or NOT_FOUND.
|
String |
getClassName()
Return the name of the class.
|
boolean |
has(String name,
Scriptable start)
Returns true if the named property is defined.
|
void |
importPackage(Context cx,
Scriptable thisObj,
Object[] args,
Function funObj)
Deprecated.
Kept only for compatibility.
|
static void |
init(Context cx,
Scriptable scope,
boolean sealed) |
static void |
init(Context cx,
Scriptable scope,
boolean sealed,
boolean isTopScope) |
void |
initStandardObjects(Context cx,
boolean sealed) |
cacheBuiltins, getBuiltinCtor, getBuiltinCtor, getBuiltinPrototype, getBuiltinPrototypeapplyDescriptorToAttributeBitset, associateValue, avoidObjectDetection, buildDataDescriptor, callMethod, callMethod, checkNotSealed, checkPropertyChangeForSlot, checkPropertyChangeForSlot, checkPropertyDefinition, checkPropertyDefinition, checkSlotRemoval, defineBuiltinProperty, defineBuiltinProperty, defineBuiltInProperty, defineBuiltInProperty, defineBuiltInProperty, defineBuiltInProperty, defineClass, defineClass, defineClass, defineConst, defineConstProperty, defineFunctionProperties, defineOwnProperties, defineOwnProperty, defineOwnProperty, defineOwnProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, delete, delete, delete, deleteProperty, deleteProperty, deleteProperty, ensureScriptable, ensureScriptableObject, ensureScriptableObjectButNotSymbol, ensureSymbolScriptable, ensureType, equivalentValues, get, get, get, getAllIds, getArrayPrototype, getAssociatedValue, getAttributes, getAttributes, getAttributes, getAttributes, getAttributes, getClassPrototype, getDefaultValue, getDefaultValue, getExternalArrayData, getExternalArrayLength, getFunctionPrototype, getGeneratorFunctionPrototype, getGetterOrSetter, getGetterOrSetter, getIds, getObjectPrototype, getOwnPropertyDescriptor, getParentScope, getProperty, getProperty, getProperty, getPropertyIds, getPrototype, getSuperProperty, getSuperProperty, getSuperProperty, getTopLevelScope, getTopScopeValue, getTypedProperty, getTypedProperty, getTypeOf, has, has, hasInstance, hasProperty, hasProperty, hasProperty, isAccessorDescriptor, isAccessorDescriptor, isConst, isDataDescriptor, isEmpty, isExtensible, isFalse, isGenericDescriptor, isGenericDescriptor, isGetterOrSetter, isGetterOrSetter, isSealed, isTrue, preventExtensions, put, put, put, putConst, putConstProperty, putOwnProperty, putOwnProperty, putOwnProperty, putProperty, putProperty, putProperty, putSuperProperty, putSuperProperty, putSuperProperty, querySlot, redefineProperty, sameValue, sealObject, setAttributes, setAttributes, setAttributes, setAttributes, setAttributes, setCommonDescriptorProperties, setExternalArrayData, setGetterOrSetter, setParentScope, setPrototype, sizecreateSlotMappublic ImporterTopLevel()
public ImporterTopLevel(Context cx)
public ImporterTopLevel(Context cx, boolean sealed)
public String getClassName()
ScriptableObjectThis is typically the same name as the constructor. Classes extending ScriptableObject must implement this abstract method.
getClassName in interface ScriptablegetClassName in class TopLevelpublic static void init(Context cx, Scriptable scope, boolean sealed)
public static void init(Context cx, Scriptable scope, boolean sealed, boolean isTopScope)
public void initStandardObjects(Context cx, boolean sealed)
public boolean has(String name, Scriptable start)
ScriptableObjecthas in interface Scriptablehas in class ScriptableObjectname - the name of the propertystart - the object in which the lookup beganScriptable.get(String, Scriptable),
ScriptableObject.getProperty(Scriptable, String)public Object get(String name, Scriptable start)
ScriptableObjectIf the property was created using defineProperty, the appropriate getter method is called.
get in interface Scriptableget in class ScriptableObjectname - the name of the propertystart - the object in which the lookup beganContext.getUndefinedValue()@Deprecated public void importPackage(Context cx, Scriptable thisObj, Object[] args, Function funObj)
Copyright © 2025 HtmlUnit. All rights reserved.