Class Environment
java.lang.Object
org.mozilla.javascript.ScriptableObject
org.mozilla.javascript.tools.shell.Environment
- All Implemented Interfaces:
Serializable,ConstProperties,DebuggableObject,Scriptable
Environment, intended to be instantiated at global scope, provides
a natural way to access System properties from JavaScript.
- See Also:
-
Field Summary
Fields inherited from class org.mozilla.javascript.ScriptableObject
CONST, DONTENUM, EMPTY, PERMANENT, READONLY, UNINITIALIZED_CONSTFields inherited from interface org.mozilla.javascript.Scriptable
NOT_FOUND -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voiddefineClass(ScriptableObject scope) get(String name, Scriptable start) Returns the value of the named property or NOT_FOUND.Object[]Returns an array of ids for the properties of the object.Return the name of the class.Object[]getIds()Returns an array of ids for the properties of the object.booleanhas(String name, Scriptable start) Returns true if the named property is defined.voidput(String name, Scriptable start, Object value) Sets the value of the named property, creating it if need be.Methods inherited from class org.mozilla.javascript.ScriptableObject
associateValue, avoidObjectDetection, callMethod, callMethod, defineClass, defineClass, defineClass, defineConst, defineConstProperty, defineFunctionProperties, defineOwnProperties, defineOwnProperty, defineProperty, defineProperty, defineProperty, defineProperty, delete, delete, deleteProperty, deleteProperty, get, get, getArrayPrototype, getAssociatedValue, getAttributes, getAttributes, getAttributes, getAttributes, getClassPrototype, getDefaultValue, getDefaultValue, getExternalArrayData, getExternalArrayLength, getFunctionPrototype, getGetterOrSetter, getObjectPrototype, getParentScope, getProperty, getProperty, getPropertyIds, getPrototype, getTopLevelScope, getTopScopeValue, getTypedProperty, getTypedProperty, getTypeOf, has, hasInstance, hasProperty, hasProperty, isConst, isEmpty, isExtensible, isSealed, preventExtensions, put, putConst, putConstProperty, putProperty, putProperty, redefineProperty, sealObject, setAttributes, setAttributes, setAttributes, setAttributes, setExternalArrayData, setGetterOrSetter, setParentScope, setPrototype, size
-
Constructor Details
-
Environment
public Environment() -
Environment
-
-
Method Details
-
defineClass
-
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 interfaceScriptable- Specified by:
getClassNamein classScriptableObject
-
has
Description copied from class:ScriptableObjectReturns true if the named property is defined.- Specified by:
hasin interfaceScriptable- Overrides:
hasin classScriptableObject- Parameters:
name- the name of the propertystart- the object in which the lookup began- Returns:
- true if and only if the property was found in the object
- See Also:
-
get
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 interfaceScriptable- Overrides:
getin classScriptableObject- Parameters:
name- the name of the propertystart- the object in which the lookup began- Returns:
- the value of the property (may be null), or NOT_FOUND
- See Also:
-
put
Description copied from class:ScriptableObjectSets the value of the named property, creating it if need be. If the property was created using defineProperty, the appropriate setter method is called.If the property's attributes include READONLY, no action is taken. This method will actually set the property in the start object.
- Specified by:
putin interfaceScriptable- Overrides:
putin classScriptableObject- Parameters:
name- the name of the propertystart- the object whose property is being setvalue- value to set the property to- See Also:
-
getIds
Description copied from class:ScriptableObjectReturns an array of ids for the properties of the object.Any properties with the attribute DONTENUM are not listed.
- Specified by:
getIdsin interfaceScriptable- Overrides:
getIdsin classScriptableObject- Returns:
- an array of java.lang.Objects with an entry for every listed property. Properties accessed via an integer index will have a corresponding Integer entry in the returned array. Properties accessed by a String will have a String entry in the returned array.
-
getAllIds
Description copied from class:ScriptableObjectReturns an array of ids for the properties of the object.All properties, even those with attribute DONTENUM, are listed.
- Specified by:
getAllIdsin interfaceDebuggableObject- Overrides:
getAllIdsin classScriptableObject- Returns:
- an array of java.lang.Objects with an entry for every listed property. Properties accessed via an integer index will have a corresponding Integer entry in the returned array. Properties accessed by a String will have a String entry in the returned array.
-