Environment (rhino 1.7.14 API)

org.mozilla.javascript.tools.shell

## Class Environment

- java.lang.Object
- - org.mozilla.javascript.ScriptableObject
  - - org.mozilla.javascript.tools.shell.Environment

- All Implemented Interfaces:
    java.io.Serializable, ConstProperties, DebuggableObject, Scriptable, SymbolScriptable

      public class Environment
      extends ScriptableObject

  Environment, intended to be instantiated at global scope, provides a natural way to access System properties from JavaScript.
  See Also:
    Serialized Form

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class org.mozilla.javascript.ScriptableObject

      `ScriptableObject.KeyComparator`

  - ### Field Summary

    - ### Fields inherited from class org.mozilla.javascript.ScriptableObject

      `CONST, DONTENUM, EMPTY, PERMANENT, READONLY, UNINITIALIZED_CONST`

    - ### Fields inherited from interface org.mozilla.javascript.Scriptable

      `NOT_FOUND`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Environment()`
    `Environment(ScriptableObject scope)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static void` | `defineClass(ScriptableObject scope)`
    `java.lang.Object` | `get(java.lang.String name, Scriptable start)` Returns the value of the named property or NOT_FOUND.
    `java.lang.Object[]` | `getAllIds()` Returns an array of ids of all non-Symbol properties of the object.
    `java.lang.String` | `getClassName()` Return the name of the class.
    `java.lang.Object[]` | `getIds()` Returns an array of ids for the properties of the object.
    `boolean` | `has(java.lang.String name, Scriptable start)` Returns true if the named property is defined.
    `void` | `put(java.lang.String name, Scriptable start, java.lang.Object value)` Sets the value of the named property, creating it if need be.

    - ### Methods inherited from class org.mozilla.javascript.ScriptableObject

      `applyDescriptorToAttributeBitset, associateValue, avoidObjectDetection, buildDataDescriptor, callMethod, callMethod, checkPropertyChange, checkPropertyDefinition, defineClass, defineClass, defineClass, defineConst, defineConstProperty, defineFunctionProperties, defineOwnProperties, defineOwnProperty, defineOwnProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, delete, delete, delete, deleteProperty, deleteProperty, ensureScriptable, ensureScriptableObject, ensureSymbolScriptable, equivalentValues, get, get, get, getArrayPrototype, getAssociatedValue, getAttributes, getAttributes, getAttributes, getAttributes, getAttributes, getClassPrototype, getDefaultValue, getDefaultValue, getExternalArrayData, getExternalArrayLength, getFunctionPrototype, getGeneratorFunctionPrototype, getGetterOrSetter, getGetterOrSetter, getObjectPrototype, getOwnPropertyDescriptor, getParentScope, getProperty, getProperty, getProperty, getPropertyIds, getPrototype, getTopLevelScope, getTopScopeValue, getTypedProperty, getTypedProperty, getTypeOf, has, has, hasInstance, hasProperty, hasProperty, hasProperty, isAccessorDescriptor, isConst, isDataDescriptor, isEmpty, isExtensible, isFalse, isGenericDescriptor, isGetterOrSetter, isSealed, isTrue, preventExtensions, put, put, putConst, putConstProperty, putProperty, putProperty, putProperty, querySlot, redefineProperty, sameValue, sealObject, setAttributes, setAttributes, setAttributes, setAttributes, setAttributes, setCommonDescriptorProperties, setExternalArrayData, setGetterOrSetter, setParentScope, setPrototype, size`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### Environment

          public Environment()

    - #### Environment

          public Environment(ScriptableObject scope)

  - ### Method Detail

    - #### defineClass

          public static void defineClass(ScriptableObject scope)

    - #### getClassName

          public java.lang.String getClassName()

      Description copied from class: `ScriptableObject`
      Return the name of the class.

      This is typically the same name as the constructor. Classes extending ScriptableObject must implement this abstract method.

      Specified by:
        `getClassName` in interface `Scriptable`
      Specified by:
        `getClassName` in class `ScriptableObject`

    - #### has

          public boolean has(java.lang.String name,
                             Scriptable start)

      Description copied from class: `ScriptableObject`
      Returns true if the named property is defined.
      Specified by:
        `has` in interface `Scriptable`
      Overrides:
        `has` in class `ScriptableObject`
      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)`

    - #### get

          public java.lang.Object get(java.lang.String name,
                                      Scriptable start)

      Description copied from class: `ScriptableObject`
      Returns the value of the named property or NOT_FOUND.

      If the property was created using defineProperty, the appropriate getter method is called.

      Specified by:
        `get` in interface `Scriptable`
      Overrides:
        `get` in class `ScriptableObject`
      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()`

    - #### put

          public void put(java.lang.String name,
                          Scriptable start,
                          java.lang.Object value)

      Description copied from class: `ScriptableObject`
      Sets 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:
        `put` in interface `Scriptable`
      Overrides:
        `put` in class `ScriptableObject`
      Parameters:
        `name` - the name of the property
        `start` - the object whose property is being set
        `value` - value to set the property to
      See Also:
        `Scriptable.has(String, Scriptable)`, `Scriptable.get(String, Scriptable)`, `ScriptableObject.putProperty(Scriptable, String, Object)`, `Context.toObject(Object, Scriptable)`

    - #### getIds

          public java.lang.Object[] getIds()

      Description copied from class: `ScriptableObject`
      Returns an array of ids for the properties of the object.

      Any properties with the attribute DONTENUM are not listed.

      Specified by:
        `getIds` in interface `Scriptable`
      Overrides:
        `getIds` in class `ScriptableObject`
      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

          public java.lang.Object[] getAllIds()

      Description copied from class: `ScriptableObject`
      Returns an array of ids of all non-Symbol properties of the object.

      All non-Symbol properties, even those with attribute DONTENUM, are listed.

      Specified by:
        `getAllIds` in interface `DebuggableObject`
      Overrides:
        `getAllIds` in class `ScriptableObject`
      Returns:
        an array of java.lang.Objects with an entry for every non-Symbol 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.