org.mozilla.javascript

## 类 ScriptableObject

- java.lang.Object
- - org.mozilla.javascript.ScriptableObject

- 所有已实现的接口:
    java.io.Serializable, org.mozilla.javascript.ConstProperties, org.mozilla.javascript.debug.DebuggableObject, org.mozilla.javascript.Scriptable
  直接已知子类:
    org.mozilla.javascript.IdScriptableObject

      public abstract class ScriptableObject
      extends java.lang.Object
      implements org.mozilla.javascript.Scriptable, java.io.Serializable, org.mozilla.javascript.debug.DebuggableObject, org.mozilla.javascript.ConstProperties

  This is the default implementation of the Scriptable interface. This class provides convenient default behavior that makes it easier to define host objects.

  Various properties and methods of JavaScript objects can be conveniently defined using methods of ScriptableObject.

  Classes extending ScriptableObject must define the getClassName method.

  另请参阅:
    `Scriptable`, 序列化表格

- - ### 字段概要

    字段
    限定符和类型 | 字段和说明
    --- | ---
    `static int` | `CONST`
    `static int` | `DONTENUM` Property attribute indicating property is not enumerated.
    `static int` | `EMPTY` The empty property attribute.
    `static int` | `PERMANENT` Property attribute indicating property cannot be deleted.
    `static int` | `READONLY` Property attribute indicating assignment to this property is ignored.
    `static int` | `UNINITIALIZED_CONST` Property attribute indicating that this is a const property that has not been assigned yet.

    - ### 从接口继承的字段 org.mozilla.javascript.Scriptable

      `NOT_FOUND`

  - ### 构造器概要

    构造器
    构造器和说明
    `ScriptableObject()`
    `ScriptableObject(org.mozilla.javascript.Scriptable scope, org.mozilla.javascript.Scriptable prototype)`

  - ### 方法概要

    所有方法 静态方法 实例方法 抽象方法 具体方法 已过时的方法
    限定符和类型 | 方法和说明
    --- | ---
    `java.lang.Object` | `associateValue(java.lang.Object key, java.lang.Object value)` Associate arbitrary application-specific value with this object.
    `boolean` | `avoidObjectDetection()` Emulate the SpiderMonkey (and Firefox) feature of allowing custom objects to avoid detection by normal "object detection" code patterns.
    `static java.lang.Object` | `callMethod(Context cx, org.mozilla.javascript.Scriptable obj, java.lang.String methodName, java.lang.Object[] args)` Call a method of an object.
    `static java.lang.Object` | `callMethod(org.mozilla.javascript.Scriptable obj, java.lang.String methodName, java.lang.Object[] args)` Call a method of an object.
    `static <T extends org.mozilla.javascript.Scriptable> void` | `defineClass(org.mozilla.javascript.Scriptable scope, java.lang.Class<T> clazz)` Defines JavaScript objects from a Java class that implements Scriptable.
    `static <T extends org.mozilla.javascript.Scriptable> void` | `defineClass(org.mozilla.javascript.Scriptable scope, java.lang.Class<T> clazz, boolean sealed)` Defines JavaScript objects from a Java class, optionally allowing sealing.
    `static <T extends org.mozilla.javascript.Scriptable> java.lang.String` | `defineClass(org.mozilla.javascript.Scriptable scope, java.lang.Class<T> clazz, boolean sealed, boolean mapInheritance)` Defines JavaScript objects from a Java class, optionally allowing sealing and mapping of Java inheritance to JavaScript prototype-based inheritance.
    `void` | `defineConst(java.lang.String name, org.mozilla.javascript.Scriptable start)`
    `static void` | `defineConstProperty(org.mozilla.javascript.Scriptable destination, java.lang.String propertyName)` Utility method to add properties to arbitrary Scriptable object.
    `void` | `defineFunctionProperties(java.lang.String[] names, java.lang.Class<?> clazz, int attributes)` Search for names in a class, adding the resulting methods as properties.
    `void` | `defineOwnProperties(Context cx, ScriptableObject props)` Defines one or more properties on this object.
    `void` | `defineOwnProperty(Context cx, java.lang.Object id, ScriptableObject desc)` Defines a property on an object.
    `static void` | `defineProperty(org.mozilla.javascript.Scriptable destination, java.lang.String propertyName, java.lang.Object value, int attributes)` Utility method to add properties to arbitrary Scriptable object.
    `void` | `defineProperty(java.lang.String propertyName, java.lang.Class<?> clazz, int attributes)` Define a JavaScript property with getter and setter side effects.
    `void` | `defineProperty(java.lang.String propertyName, java.lang.Object value, int attributes)` Define a JavaScript property.
    `void` | `defineProperty(java.lang.String propertyName, java.lang.Object delegateTo, java.lang.reflect.Method getter, java.lang.reflect.Method setter, int attributes)` Define a JavaScript property.
    `void` | `delete(int index)` Removes the indexed property from the object.
    `void` | `delete(java.lang.String name)` Removes a named property from the object.
    `static boolean` | `deleteProperty(org.mozilla.javascript.Scriptable obj, int index)` Removes the property from an object or its prototype chain.
    `static boolean` | `deleteProperty(org.mozilla.javascript.Scriptable obj, java.lang.String name)` Removes the property from an object or its prototype chain.
    `java.lang.Object` | `get(int index, org.mozilla.javascript.Scriptable start)` Returns the value of the indexed property or NOT_FOUND.
    `java.lang.Object` | `get(java.lang.Object key)`
    `java.lang.Object` | `get(java.lang.String name, org.mozilla.javascript.Scriptable start)` Returns the value of the named property or NOT_FOUND.
    `java.lang.Object[]` | `getAllIds()` Returns an array of ids for the properties of the object.
    `static org.mozilla.javascript.Scriptable` | `getArrayPrototype(org.mozilla.javascript.Scriptable scope)`
    `java.lang.Object` | `getAssociatedValue(java.lang.Object key)` Get arbitrary application-specific value associated with this object.
    `int` | `getAttributes(int index)` Get the attributes of an indexed property.
    `int` | `getAttributes(int index, org.mozilla.javascript.Scriptable start)` 已过时。 Use `getAttributes(int index)`. The engine always ignored the start argument.
    `int` | `getAttributes(java.lang.String name)` Get the attributes of a named property.
    `int` | `getAttributes(java.lang.String name, org.mozilla.javascript.Scriptable start)` 已过时。 Use `getAttributes(String name)`. The engine always ignored the start argument.
    `abstract java.lang.String` | `getClassName()` Return the name of the class.
    `static org.mozilla.javascript.Scriptable` | `getClassPrototype(org.mozilla.javascript.Scriptable scope, java.lang.String className)` Get the prototype for the named class.
    `java.lang.Object` | `getDefaultValue(java.lang.Class<?> typeHint)` Implements the [[DefaultValue]] internal method.
    `static java.lang.Object` | `getDefaultValue(org.mozilla.javascript.Scriptable object, java.lang.Class<?> typeHint)`
    `org.mozilla.javascript.ExternalArrayData` | `getExternalArrayData()` Return the array that was previously set by the call to "setExternalArrayData".
    `java.lang.Object` | `getExternalArrayLength()` This is a function used by setExternalArrayData to dynamically get the "length" property value.
    `static org.mozilla.javascript.Scriptable` | `getFunctionPrototype(org.mozilla.javascript.Scriptable scope)` Get the Function.prototype property.
    `java.lang.Object` | `getGetterOrSetter(java.lang.String name, int index, boolean isSetter)` Get the getter or setter for a given property.
    `java.lang.Object[]` | `getIds()` Returns an array of ids for the properties of the object.
    `static org.mozilla.javascript.Scriptable` | `getObjectPrototype(org.mozilla.javascript.Scriptable scope)` Get the Object.prototype property.
    `org.mozilla.javascript.Scriptable` | `getParentScope()` Returns the parent (enclosing) scope of the object.
    `static java.lang.Object` | `getProperty(org.mozilla.javascript.Scriptable obj, int index)` Gets an indexed property from an object or any object in its prototype chain.
    `static java.lang.Object` | `getProperty(org.mozilla.javascript.Scriptable obj, java.lang.String name)` Gets a named property from an object or any object in its prototype chain.
    `static java.lang.Object[]` | `getPropertyIds(org.mozilla.javascript.Scriptable obj)` Returns an array of all ids from an object and its prototypes.
    `org.mozilla.javascript.Scriptable` | `getPrototype()` Returns the prototype of the object.
    `static org.mozilla.javascript.Scriptable` | `getTopLevelScope(org.mozilla.javascript.Scriptable obj)` Get the global scope.
    `static java.lang.Object` | `getTopScopeValue(org.mozilla.javascript.Scriptable scope, java.lang.Object key)` Get arbitrary application-specific value associated with the top scope of the given scope.
    `static <T> T` | `getTypedProperty(org.mozilla.javascript.Scriptable s, int index, java.lang.Class<T> type)` Gets an indexed property from an object or any object in its prototype chain and coerces it to the requested Java type.
    `static <T> T` | `getTypedProperty(org.mozilla.javascript.Scriptable s, java.lang.String name, java.lang.Class<T> type)` Gets a named property from an object or any object in its prototype chain and coerces it to the requested Java type.
    `java.lang.String` | `getTypeOf()` Gets the value that will be returned by calling the typeof operator on this object.
    `boolean` | `has(int index, org.mozilla.javascript.Scriptable start)` Returns true if the property index is defined.
    `boolean` | `has(java.lang.String name, org.mozilla.javascript.Scriptable start)` Returns true if the named property is defined.
    `boolean` | `hasInstance(org.mozilla.javascript.Scriptable instance)` Implements the instanceof operator.
    `static boolean` | `hasProperty(org.mozilla.javascript.Scriptable obj, int index)` Returns whether an indexed property is defined in an object or any object in its prototype chain.
    `static boolean` | `hasProperty(org.mozilla.javascript.Scriptable obj, java.lang.String name)` Returns whether a named property is defined in an object or any object in its prototype chain.
    `boolean` | `isConst(java.lang.String name)` Returns true if the named property is defined as a const on this object.
    `boolean` | `isEmpty()`
    `boolean` | `isExtensible()`
    `boolean` | `isSealed()` Return true if this object is sealed.
    `void` | `preventExtensions()`
    `void` | `put(int index, org.mozilla.javascript.Scriptable start, java.lang.Object value)` Sets the value of the indexed property, creating it if need be.
    `void` | `put(java.lang.String name, org.mozilla.javascript.Scriptable start, java.lang.Object value)` Sets the value of the named property, creating it if need be.
    `void` | `putConst(java.lang.String name, org.mozilla.javascript.Scriptable start, java.lang.Object value)` Sets the value of the named const property, creating it if need be.
    `static void` | `putConstProperty(org.mozilla.javascript.Scriptable obj, java.lang.String name, java.lang.Object value)` Puts a named property in an object or in an object in its prototype chain.
    `static void` | `putProperty(org.mozilla.javascript.Scriptable obj, int index, java.lang.Object value)` Puts an indexed property in an object or in an object in its prototype chain.
    `static void` | `putProperty(org.mozilla.javascript.Scriptable obj, java.lang.String name, java.lang.Object value)` Puts a named property in an object or in an object in its prototype chain.
    `static void` | `redefineProperty(org.mozilla.javascript.Scriptable obj, java.lang.String name, boolean isConst)` If hasProperty(obj, name) would return true, then if the property that was found is compatible with the new property, this method just returns.
    `void` | `sealObject()` Seal this object.
    `void` | `setAttributes(int index, int attributes)` Set the attributes of an indexed property.
    `void` | `setAttributes(int index, org.mozilla.javascript.Scriptable start, int attributes)` 已过时。 Use `setAttributes(int index, int attributes)`. The engine always ignored the start argument.
    `void` | `setAttributes(java.lang.String name, int attributes)` Set the attributes of a named property.
    `void` | `setAttributes(java.lang.String name, org.mozilla.javascript.Scriptable start, int attributes)` 已过时。 Use `setAttributes(String name, int attributes)`. The engine always ignored the start argument.
    `void` | `setExternalArrayData(org.mozilla.javascript.ExternalArrayData array)` Attach the specified object to this object, and delegate all indexed property lookups to it.
    `void` | `setGetterOrSetter(java.lang.String name, int index, org.mozilla.javascript.Callable getterOrSetter, boolean isSetter)` XXX: write docs.
    `void` | `setParentScope(org.mozilla.javascript.Scriptable m)` Sets the parent (enclosing) scope of the object.
    `void` | `setPrototype(org.mozilla.javascript.Scriptable m)` Sets the prototype of the object.
    `int` | `size()`

    - ### 从类继承的方法 java.lang.Object

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

- - ### 字段详细资料

    - #### EMPTY

          public static final int EMPTY

      The empty property attribute. Used by getAttributes() and setAttributes().
      另请参阅:
        `getAttributes(String)`, `setAttributes(String, int)`, 常量字段值

    - #### READONLY

          public static final int READONLY

      Property attribute indicating assignment to this property is ignored.
      另请参阅:
        `#put(String, Scriptable, Object)`, `getAttributes(String)`, `setAttributes(String, int)`, 常量字段值

    - #### DONTENUM

          public static final int DONTENUM

      Property attribute indicating property is not enumerated. Only enumerated properties will be returned by getIds().
      另请参阅:
        `getIds()`, `getAttributes(String)`, `setAttributes(String, int)`, 常量字段值

    - #### PERMANENT

          public static final int PERMANENT

      Property attribute indicating property cannot be deleted.
      另请参阅:
        `delete(String)`, `getAttributes(String)`, `setAttributes(String, int)`, 常量字段值

    - #### UNINITIALIZED_CONST

          public static final int UNINITIALIZED_CONST

      Property attribute indicating that this is a const property that has not been assigned yet. The first 'const' assignment to the property will clear this bit.
      另请参阅:
        常量字段值

    - #### CONST

          public static final int CONST

      另请参阅:
        常量字段值

  - ### 构造器详细资料

    - #### ScriptableObject

          public ScriptableObject()

    - #### ScriptableObject

          public ScriptableObject(org.mozilla.javascript.Scriptable scope,
                                  org.mozilla.javascript.Scriptable prototype)

  - ### 方法详细资料

    - #### getTypeOf

          public java.lang.String getTypeOf()

      Gets the value that will be returned by calling the typeof operator on this object.
      返回:
        default is "object" unless `avoidObjectDetection()` is `true` in which case it returns "undefined"

    - #### getClassName

          public abstract java.lang.String getClassName()

      Return the name of the class. This is typically the same name as the constructor. Classes extending ScriptableObject must implement this abstract method.
      指定者:
        `getClassName` 在接口中 `org.mozilla.javascript.Scriptable`

    - #### has

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

      Returns true if the named property is defined.
      指定者:
        `has` 在接口中 `org.mozilla.javascript.Scriptable`
      参数:
        `name` - the name of the property
        `start` - the object in which the lookup began
      返回:
        true if and only if the property was found in the object

    - #### has

          public boolean has(int index,
                             org.mozilla.javascript.Scriptable start)

      Returns true if the property index is defined.
      指定者:
        `has` 在接口中 `org.mozilla.javascript.Scriptable`
      参数:
        `index` - the numeric index for the property
        `start` - the object in which the lookup began
      返回:
        true if and only if the property was found in the object

    - #### get

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

      Returns the value of the named property or NOT_FOUND. If the property was created using defineProperty, the appropriate getter method is called.
      指定者:
        `get` 在接口中 `org.mozilla.javascript.Scriptable`
      参数:
        `name` - the name of the property
        `start` - the object in which the lookup began
      返回:
        the value of the property (may be null), or NOT_FOUND

    - #### get

          public java.lang.Object get(int index,
                                      org.mozilla.javascript.Scriptable start)

      Returns the value of the indexed property or NOT_FOUND.
      指定者:
        `get` 在接口中 `org.mozilla.javascript.Scriptable`
      参数:
        `index` - the numeric index for the property
        `start` - the object in which the lookup began
      返回:
        the value of the property (may be null), or NOT_FOUND

    - #### put

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

      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.

      指定者:
        `put` 在接口中 `org.mozilla.javascript.Scriptable`
      参数:
        `name` - the name of the property
        `start` - the object whose property is being set
        `value` - value to set the property to

    - #### put

          public void put(int index,
                          org.mozilla.javascript.Scriptable start,
                          java.lang.Object value)

      Sets the value of the indexed property, creating it if need be.
      指定者:
        `put` 在接口中 `org.mozilla.javascript.Scriptable`
      参数:
        `index` - the numeric index for the property
        `start` - the object whose property is being set
        `value` - value to set the property to

    - #### delete

          public void delete(java.lang.String name)

      Removes a named property from the object. If the property is not found, or it has the PERMANENT attribute, no action is taken.
      指定者:
        `delete` 在接口中 `org.mozilla.javascript.Scriptable`
      参数:
        `name` - the name of the property

    - #### delete

          public void delete(int index)

      Removes the indexed property from the object. If the property is not found, or it has the PERMANENT attribute, no action is taken.
      指定者:
        `delete` 在接口中 `org.mozilla.javascript.Scriptable`
      参数:
        `index` - the numeric index for the property

    - #### putConst

          public void putConst(java.lang.String name,
                               org.mozilla.javascript.Scriptable start,
                               java.lang.Object value)

      Sets the value of the named const 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.

      指定者:
        `putConst` 在接口中 `org.mozilla.javascript.ConstProperties`
      参数:
        `name` - the name of the property
        `start` - the object whose property is being set
        `value` - value to set the property to

    - #### defineConst

          public void defineConst(java.lang.String name,
                                  org.mozilla.javascript.Scriptable start)

      指定者:
        `defineConst` 在接口中 `org.mozilla.javascript.ConstProperties`

    - #### isConst

          public boolean isConst(java.lang.String name)

      Returns true if the named property is defined as a const on this object.
      指定者:
        `isConst` 在接口中 `org.mozilla.javascript.ConstProperties`
      参数:
        `name` -
      返回:
        true if the named property is defined as a const, false otherwise.

    - #### getAttributes

          @Deprecated
          public final int getAttributes(java.lang.String name,
                                                      org.mozilla.javascript.Scriptable start)

      已过时。 Use `getAttributes(String name)`. The engine always ignored the start argument.

    - #### getAttributes

          @Deprecated
          public final int getAttributes(int index,
                                                      org.mozilla.javascript.Scriptable start)

      已过时。 Use `getAttributes(int index)`. The engine always ignored the start argument.

    - #### setAttributes

          @Deprecated
          public final void setAttributes(java.lang.String name,
                                                       org.mozilla.javascript.Scriptable start,
                                                       int attributes)

      已过时。 Use `setAttributes(String name, int attributes)`. The engine always ignored the start argument.

    - #### setAttributes

          @Deprecated
          public void setAttributes(int index,
                                                 org.mozilla.javascript.Scriptable start,
                                                 int attributes)

      已过时。 Use `setAttributes(int index, int attributes)`. The engine always ignored the start argument.

    - #### getAttributes

          public int getAttributes(java.lang.String name)

      Get the attributes of a named property. The property is specified by `name` as defined for `has`.

      参数:
        `name` - the identifier for the property
      返回:
        the bitset of attributes
      抛出:
        `EvaluatorException` - if the named property is not found
      另请参阅:
        `has(String, Scriptable)`, `READONLY`, `DONTENUM`, `PERMANENT`, `EMPTY`

    - #### getAttributes

          public int getAttributes(int index)

      Get the attributes of an indexed property.
      参数:
        `index` - the numeric index for the property
      返回:
        the bitset of attributes
      抛出:
        `EvaluatorException` - if the named property is not found is not found
      另请参阅:
        `has(String, Scriptable)`, `READONLY`, `DONTENUM`, `PERMANENT`, `EMPTY`

    - #### setAttributes

          public void setAttributes(java.lang.String name,
                                    int attributes)

      Set the attributes of a named property. The property is specified by `name` as defined for `has`.

      The possible attributes are READONLY, DONTENUM, and PERMANENT. Combinations of attributes are expressed by the bitwise OR of attributes. EMPTY is the state of no attributes set. Any unused bits are reserved for future use.

      参数:
        `name` - the name of the property
        `attributes` - the bitset of attributes
      抛出:
        `EvaluatorException` - if the named property is not found
      另请参阅:
        `Scriptable.has(String, Scriptable)`, `READONLY`, `DONTENUM`, `PERMANENT`, `EMPTY`

    - #### setAttributes

          public void setAttributes(int index,
                                    int attributes)

      Set the attributes of an indexed property.
      参数:
        `index` - the numeric index for the property
        `attributes` - the bitset of attributes
      抛出:
        `EvaluatorException` - if the named property is not found
      另请参阅:
        `Scriptable.has(String, Scriptable)`, `READONLY`, `DONTENUM`, `PERMANENT`, `EMPTY`

    - #### setGetterOrSetter

          public void setGetterOrSetter(java.lang.String name,
                                        int index,
                                        org.mozilla.javascript.Callable getterOrSetter,
                                        boolean isSetter)

      XXX: write docs.

    - #### getGetterOrSetter

          public java.lang.Object getGetterOrSetter(java.lang.String name,
                                                    int index,
                                                    boolean isSetter)

      Get the getter or setter for a given property. Used by __lookupGetter__ and __lookupSetter__.
      参数:
        `name` - Name of the object. If nonnull, index must be 0.
        `index` - Index of the object. If nonzero, name must be null.
        `isSetter` - If true, return the setter, otherwise return the getter.
      返回:
        Null if the property does not exist. Otherwise returns either the getter or the setter for the property, depending on the value of isSetter (may be undefined if unset).
      抛出:
        `java.lang.IllegalArgumentException` - if both name and index are nonnull and nonzero respectively.

    - #### setExternalArrayData

          public void setExternalArrayData(org.mozilla.javascript.ExternalArrayData array)

      Attach the specified object to this object, and delegate all indexed property lookups to it. In other words, if the object has 3 elements, then an attempt to look up or modify "[0]", "[1]", or "[2]" will be delegated to this object. Additional indexed properties outside the range specified, and additional non-indexed properties, may still be added. The object specified must implement the ExternalArrayData interface.
      参数:
        `array` - the List to use for delegated property access. Set this to null to revert back to regular property access.
      从以下版本开始:
        1.7.6

    - #### getExternalArrayData

          public org.mozilla.javascript.ExternalArrayData getExternalArrayData()

      Return the array that was previously set by the call to "setExternalArrayData".
      返回:
        the array, or null if it was never set
      从以下版本开始:
        1.7.6

    - #### getExternalArrayLength

          public java.lang.Object getExternalArrayLength()

      This is a function used by setExternalArrayData to dynamically get the "length" property value.

    - #### getPrototype

          public org.mozilla.javascript.Scriptable getPrototype()

      Returns the prototype of the object.
      指定者:
        `getPrototype` 在接口中 `org.mozilla.javascript.Scriptable`

    - #### setPrototype

          public void setPrototype(org.mozilla.javascript.Scriptable m)

      Sets the prototype of the object.
      指定者:
        `setPrototype` 在接口中 `org.mozilla.javascript.Scriptable`

    - #### getParentScope

          public org.mozilla.javascript.Scriptable getParentScope()

      Returns the parent (enclosing) scope of the object.
      指定者:
        `getParentScope` 在接口中 `org.mozilla.javascript.Scriptable`

    - #### setParentScope

          public void setParentScope(org.mozilla.javascript.Scriptable m)

      Sets the parent (enclosing) scope of the object.
      指定者:
        `setParentScope` 在接口中 `org.mozilla.javascript.Scriptable`

    - #### getIds

          public java.lang.Object[] getIds()

      Returns an array of ids for the properties of the object.

      Any properties with the attribute DONTENUM are not listed.

      指定者:
        `getIds` 在接口中 `org.mozilla.javascript.Scriptable`
      返回:
        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()

      Returns an array of ids for the properties of the object.

      All properties, even those with attribute DONTENUM, are listed.

      指定者:
        `getAllIds` 在接口中 `org.mozilla.javascript.debug.DebuggableObject`
      返回:
        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.

    - #### getDefaultValue

          public java.lang.Object getDefaultValue(java.lang.Class<?> typeHint)

      Implements the [[DefaultValue]] internal method.

      Note that the toPrimitive conversion is a no-op for every type other than Object, for which [[DefaultValue]] is called. See ECMA 9.1.

      A `hint` of null means "no hint".

      指定者:
        `getDefaultValue` 在接口中 `org.mozilla.javascript.Scriptable`
      参数:
        `typeHint` - the type hint
      返回:
        the default value for the object See ECMA 8.6.2.6.

    - #### getDefaultValue

          public static java.lang.Object getDefaultValue(org.mozilla.javascript.Scriptable object,
                                                         java.lang.Class<?> typeHint)

    - #### hasInstance

          public boolean hasInstance(org.mozilla.javascript.Scriptable instance)

      Implements the instanceof operator.

      This operator has been proposed to ECMA.

      指定者:
        `hasInstance` 在接口中 `org.mozilla.javascript.Scriptable`
      参数:
        `instance` - The value that appeared on the LHS of the instanceof operator
      返回:
        true if "this" appears in value's prototype chain

    - #### avoidObjectDetection

          public boolean avoidObjectDetection()

      Emulate the SpiderMonkey (and Firefox) feature of allowing custom objects to avoid detection by normal "object detection" code patterns. This is used to implement document.all. See https://bugzilla.mozilla.org/show_bug.cgi?id=412247. This is an analog to JOF_DETECTING from SpiderMonkey; see https://bugzilla.mozilla.org/show_bug.cgi?id=248549. Other than this special case, embeddings should return false.
      返回:
        true if this object should avoid object detection
      从以下版本开始:
        1.7R1

    - #### defineClass

          public static <T extends org.mozilla.javascript.Scriptable> void defineClass(org.mozilla.javascript.Scriptable scope,
                                                                                       java.lang.Class<T> clazz)
                                                                                throws java.lang.IllegalAccessException,
                                                                                       java.lang.InstantiationException,
                                                                                       java.lang.reflect.InvocationTargetException

      Defines JavaScript objects from a Java class that implements Scriptable. If the given class has a method

           static void init(Context cx, Scriptable scope, boolean sealed);

      or its compatibility form

           static void init(Scriptable scope);

      then it is invoked and no further initialization is done.

      However, if no such a method is found, then the class's constructors and methods are used to initialize a class in the following manner.

      First, the zero-parameter constructor of the class is called to create the prototype. If no such constructor exists, a `EvaluatorException` is thrown.

      Next, all methods are scanned for special prefixes that indicate that they have special meaning for defining JavaScript objects. These special prefixes are

      - `jsFunction_` for a JavaScript function
      - `jsStaticFunction_` for a JavaScript function that is a property of the constructor
      - `jsGet_` for a getter of a JavaScript property
      - `jsSet_` for a setter of a JavaScript property
      - `jsConstructor` for a JavaScript function that is the constructor

      If the method's name begins with "jsFunction_", a JavaScript function is created with a name formed from the rest of the Java method name following "jsFunction_". So a Java method named "jsFunction_foo" will define a JavaScript method "foo". Calling this JavaScript function will cause the Java method to be called. The parameters of the method must be of number and types as defined by the FunctionObject class. The JavaScript function is then added as a property of the prototype.

      If the method's name begins with "jsStaticFunction_", it is handled similarly except that the resulting JavaScript function is added as a property of the constructor object. The Java method must be static. If the method's name begins with "jsGet_" or "jsSet_", the method is considered to define a property. Accesses to the defined property will result in calls to these getter and setter methods. If no setter is defined, the property is defined as READONLY.

      If the method's name is "jsConstructor", the method is considered to define the body of the constructor. Only one method of this name may be defined. You may use the varargs forms for constructors documented in `FunctionObject.FunctionObject(String, Member, Scriptable)` If no method is found that can serve as constructor, a Java constructor will be selected to serve as the JavaScript constructor in the following manner. If the class has only one Java constructor, that constructor is used to define the JavaScript constructor. If the the class has two constructors, one must be the zero-argument constructor (otherwise an `EvaluatorException` would have already been thrown when the prototype was to be created). In this case the Java constructor with one or more parameters will be used to define the JavaScript constructor. If the class has three or more constructors, an `EvaluatorException` will be thrown.

      Finally, if there is a method

           static void finishInit(Scriptable scope, FunctionObject constructor,
                                  Scriptable prototype)

      it will be called to finish any initialization. The `scope` argument will be passed, along with the newly created constructor and the newly created prototype.

      参数:
        `scope` - The scope in which to define the constructor.
        `clazz` - The Java class to use to define the JavaScript objects and properties.
      抛出:
        `java.lang.IllegalAccessException` - if access is not available to a reflected class member
        `java.lang.InstantiationException` - if unable to instantiate the named class
        `java.lang.reflect.InvocationTargetException` - if an exception is thrown during execution of methods of the named class
      另请参阅:
        `Function`, `FunctionObject`, `READONLY`, `#defineProperty(String, Class, int)`

    - #### defineClass

          public static <T extends org.mozilla.javascript.Scriptable> void defineClass(org.mozilla.javascript.Scriptable scope,
                                                                                       java.lang.Class<T> clazz,
                                                                                       boolean sealed)
                                                                                throws java.lang.IllegalAccessException,
                                                                                       java.lang.InstantiationException,
                                                                                       java.lang.reflect.InvocationTargetException

      Defines JavaScript objects from a Java class, optionally allowing sealing. Similar to `defineClass(Scriptable scope, Class clazz)` except that sealing is allowed. An object that is sealed cannot have properties added or removed. Note that sealing is not allowed in the current ECMA/ISO language specification, but is likely for the next version.
      参数:
        `scope` - The scope in which to define the constructor.
        `clazz` - The Java class to use to define the JavaScript objects and properties. The class must implement Scriptable.
        `sealed` - Whether or not to create sealed standard objects that cannot be modified.
      抛出:
        `java.lang.IllegalAccessException` - if access is not available to a reflected class member
        `java.lang.InstantiationException` - if unable to instantiate the named class
        `java.lang.reflect.InvocationTargetException` - if an exception is thrown during execution of methods of the named class
      从以下版本开始:
        1.4R3

    - #### defineClass

          public static <T extends org.mozilla.javascript.Scriptable> java.lang.String defineClass(org.mozilla.javascript.Scriptable scope,
                                                                                                   java.lang.Class<T> clazz,
                                                                                                   boolean sealed,
                                                                                                   boolean mapInheritance)
                                                                                            throws java.lang.IllegalAccessException,
                                                                                                   java.lang.InstantiationException,
                                                                                                   java.lang.reflect.InvocationTargetException

      Defines JavaScript objects from a Java class, optionally allowing sealing and mapping of Java inheritance to JavaScript prototype-based inheritance. Similar to `defineClass(Scriptable scope, Class clazz)` except that sealing and inheritance mapping are allowed. An object that is sealed cannot have properties added or removed. Note that sealing is not allowed in the current ECMA/ISO language specification, but is likely for the next version.
      参数:
        `scope` - The scope in which to define the constructor.
        `clazz` - The Java class to use to define the JavaScript objects and properties. The class must implement Scriptable.
        `sealed` - Whether or not to create sealed standard objects that cannot be modified.
        `mapInheritance` - Whether or not to map Java inheritance to JavaScript prototype-based inheritance.
      返回:
        the class name for the prototype of the specified class
      抛出:
        `java.lang.IllegalAccessException` - if access is not available to a reflected class member
        `java.lang.InstantiationException` - if unable to instantiate the named class
        `java.lang.reflect.InvocationTargetException` - if an exception is thrown during execution of methods of the named class
      从以下版本开始:
        1.6R2

    - #### defineProperty

          public void defineProperty(java.lang.String propertyName,
                                     java.lang.Object value,
                                     int attributes)

      Define a JavaScript property. Creates the property with an initial value and sets its attributes.
      参数:
        `propertyName` - the name of the property to define.
        `value` - the initial value of the property
        `attributes` - the attributes of the JavaScript property
      另请参阅:
        `Scriptable.put(String, Scriptable, Object)`

    - #### defineProperty

          public static void defineProperty(org.mozilla.javascript.Scriptable destination,
                                            java.lang.String propertyName,
                                            java.lang.Object value,
                                            int attributes)

      Utility method to add properties to arbitrary Scriptable object. If destination is instance of ScriptableObject, calls defineProperty there, otherwise calls put in destination ignoring attributes

    - #### defineConstProperty

          public static void defineConstProperty(org.mozilla.javascript.Scriptable destination,
                                                 java.lang.String propertyName)

      Utility method to add properties to arbitrary Scriptable object. If destination is instance of ScriptableObject, calls defineProperty there, otherwise calls put in destination ignoring attributes

    - #### defineProperty

          public void defineProperty(java.lang.String propertyName,
                                     java.lang.Class<?> clazz,
                                     int attributes)

      Define a JavaScript property with getter and setter side effects. If the setter is not found, the attribute READONLY is added to the given attributes.

      The getter must be a method with zero parameters, and the setter, if found, must be a method with one parameter.

      参数:
        `propertyName` - the name of the property to define. This name also affects the name of the setter and getter to search for. If the propertyId is "foo", then `clazz` will be searched for "getFoo" and "setFoo" methods.
        `clazz` - the Java class to search for the getter and setter
        `attributes` - the attributes of the JavaScript property
      另请参阅:
        `Scriptable.put(String, Scriptable, Object)`

    - #### defineProperty

          public void defineProperty(java.lang.String propertyName,
                                     java.lang.Object delegateTo,
                                     java.lang.reflect.Method getter,
                                     java.lang.reflect.Method setter,
                                     int attributes)

      Define a JavaScript property. Use this method only if you wish to define getters and setters for a given property in a ScriptableObject. To create a property without special getter or setter side effects, use `defineProperty(String,int)`. If `setter` is null, the attribute READONLY is added to the given attributes.

      Several forms of getters or setters are allowed. In all cases the type of the value parameter can be any one of the following types: Object, String, boolean, Scriptable, byte, short, int, long, float, or double. The runtime will perform appropriate conversions based upon the type of the parameter (see description in FunctionObject). The first forms are nonstatic methods of the class referred to by 'this':

           Object getFoo();
           void setFoo(SomeType value);

      Next are static methods that may be of any class; the object whose property is being accessed is passed in as an extra argument:

           static Object getFoo(Scriptable obj);
           static void setFoo(Scriptable obj, SomeType value);

      Finally, it is possible to delegate to another object entirely using the `delegateTo` parameter. In this case the methods are nonstatic methods of the class delegated to, and the object whose property is being accessed is passed in as an extra argument:

           Object getFoo(Scriptable obj);
           void setFoo(Scriptable obj, SomeType value);

      参数:
        `propertyName` - the name of the property to define.
        `delegateTo` - an object to call the getter and setter methods on, or null, depending on the form used above.
        `getter` - the method to invoke to get the value of the property
        `setter` - the method to invoke to set the value of the property
        `attributes` - the attributes of the JavaScript property

    - #### defineOwnProperties

          public void defineOwnProperties(Context cx,
                                          ScriptableObject props)

      Defines one or more properties on this object.
      参数:
        `cx` - the current Context
        `props` - a map of property ids to property descriptors

    - #### defineOwnProperty

          public void defineOwnProperty(Context cx,
                                        java.lang.Object id,
                                        ScriptableObject desc)

      Defines a property on an object.
      参数:
        `cx` - the current Context
        `id` - the name/index of the property
        `desc` - the new property descriptor, as described in 8.6.1

    - #### defineFunctionProperties

          public void defineFunctionProperties(java.lang.String[] names,
                                               java.lang.Class<?> clazz,
                                               int attributes)

      Search for names in a class, adding the resulting methods as properties.

      Uses reflection to find the methods of the given names. Then FunctionObjects are constructed from the methods found, and are added to this object as properties with the given names.

      参数:
        `names` - the names of the Methods to add as function properties
        `clazz` - the class to search for the Methods
        `attributes` - the attributes of the new properties
      另请参阅:
        `FunctionObject`

    - #### getObjectPrototype

          public static org.mozilla.javascript.Scriptable getObjectPrototype(org.mozilla.javascript.Scriptable scope)

      Get the Object.prototype property. See ECMA 15.2.4.

    - #### getFunctionPrototype

          public static org.mozilla.javascript.Scriptable getFunctionPrototype(org.mozilla.javascript.Scriptable scope)

      Get the Function.prototype property. See ECMA 15.3.4.

    - #### getArrayPrototype

          public static org.mozilla.javascript.Scriptable getArrayPrototype(org.mozilla.javascript.Scriptable scope)

    - #### getClassPrototype

          public static org.mozilla.javascript.Scriptable getClassPrototype(org.mozilla.javascript.Scriptable scope,
                                                                            java.lang.String className)

      Get the prototype for the named class. For example, `getClassPrototype(s, "Date")` will first walk up the parent chain to find the outermost scope, then will search that scope for the Date constructor, and then will return Date.prototype. If any of the lookups fail, or the prototype is not a JavaScript object, then null will be returned.
      参数:
        `scope` - an object in the scope chain
        `className` - the name of the constructor
      返回:
        the prototype for the named class, or null if it cannot be found.

    - #### getTopLevelScope

          public static org.mozilla.javascript.Scriptable getTopLevelScope(org.mozilla.javascript.Scriptable obj)

      Get the global scope.

      Walks the parent scope chain to find an object with a null parent scope (the global object).

      参数:
        `obj` - a JavaScript object
      返回:
        the corresponding global scope

    - #### isExtensible

          public boolean isExtensible()

    - #### preventExtensions

          public void preventExtensions()

    - #### sealObject

          public void sealObject()

      Seal this object. It is an error to add properties to or delete properties from a sealed object. It is possible to change the value of an existing property. Once an object is sealed it may not be unsealed.
      从以下版本开始:
        1.4R3

    - #### isSealed

          public final boolean isSealed()

      Return true if this object is sealed.
      返回:
        true if sealed, false otherwise.
      从以下版本开始:
        1.4R3
      另请参阅:
        `sealObject()`

    - #### getProperty

          public static java.lang.Object getProperty(org.mozilla.javascript.Scriptable obj,
                                                     java.lang.String name)

      Gets a named property from an object or any object in its prototype chain.

      Searches the prototype chain for a property named `name`.

      参数:
        `obj` - a JavaScript object
        `name` - a property name
      返回:
        the value of a property with name `name` found in `obj` or any object in its prototype chain, or `Scriptable.NOT_FOUND` if not found
      从以下版本开始:
        1.5R2

    - #### getTypedProperty

          public static <T> T getTypedProperty(org.mozilla.javascript.Scriptable s,
                                               int index,
                                               java.lang.Class<T> type)

      Gets an indexed property from an object or any object in its prototype chain and coerces it to the requested Java type.

      Searches the prototype chain for a property with integral index `index`. Note that if you wish to look for properties with numerical but non-integral indicies, you should use getProperty(Scriptable,String) with the string value of the index.

      参数:
        `s` - a JavaScript object
        `index` - an integral index
        `type` - the required Java type of the result
      返回:
        the value of a property with name `name` found in `obj` or any object in its prototype chain, or null if not found. Note that it does not return `Scriptable.NOT_FOUND` as it can ordinarily not be converted to most of the types.
      从以下版本开始:
        1.7R3

    - #### getProperty

          public static java.lang.Object getProperty(org.mozilla.javascript.Scriptable obj,
                                                     int index)

      Gets an indexed property from an object or any object in its prototype chain.

      Searches the prototype chain for a property with integral index `index`. Note that if you wish to look for properties with numerical but non-integral indicies, you should use getProperty(Scriptable,String) with the string value of the index.

      参数:
        `obj` - a JavaScript object
        `index` - an integral index
      返回:
        the value of a property with index `index` found in `obj` or any object in its prototype chain, or `Scriptable.NOT_FOUND` if not found
      从以下版本开始:
        1.5R2

    - #### getTypedProperty

          public static <T> T getTypedProperty(org.mozilla.javascript.Scriptable s,
                                               java.lang.String name,
                                               java.lang.Class<T> type)

      Gets a named property from an object or any object in its prototype chain and coerces it to the requested Java type.

      Searches the prototype chain for a property named `name`.

      参数:
        `s` - a JavaScript object
        `name` - a property name
        `type` - the required Java type of the result
      返回:
        the value of a property with name `name` found in `obj` or any object in its prototype chain, or null if not found. Note that it does not return `Scriptable.NOT_FOUND` as it can ordinarily not be converted to most of the types.
      从以下版本开始:
        1.7R3

    - #### hasProperty

          public static boolean hasProperty(org.mozilla.javascript.Scriptable obj,
                                            java.lang.String name)

      Returns whether a named property is defined in an object or any object in its prototype chain.

      Searches the prototype chain for a property named `name`.

      参数:
        `obj` - a JavaScript object
        `name` - a property name
      返回:
        the true if property was found
      从以下版本开始:
        1.5R2

    - #### redefineProperty

          public static void redefineProperty(org.mozilla.javascript.Scriptable obj,
                                              java.lang.String name,
                                              boolean isConst)

      If hasProperty(obj, name) would return true, then if the property that was found is compatible with the new property, this method just returns. If the property is not compatible, then an exception is thrown. A property redefinition is incompatible if the first definition was a const declaration or if this one is. They are compatible only if neither was const.

    - #### hasProperty

          public static boolean hasProperty(org.mozilla.javascript.Scriptable obj,
                                            int index)

      Returns whether an indexed property is defined in an object or any object in its prototype chain.

      Searches the prototype chain for a property with index `index`.

      参数:
        `obj` - a JavaScript object
        `index` - a property index
      返回:
        the true if property was found
      从以下版本开始:
        1.5R2

    - #### putProperty

          public static void putProperty(org.mozilla.javascript.Scriptable obj,
                                         java.lang.String name,
                                         java.lang.Object value)

      Puts a named property in an object or in an object in its prototype chain.

      Searches for the named property in the prototype chain. If it is found, the value of the property in `obj` is changed through a call to `Scriptable.put(String, Scriptable, Object)` on the prototype passing `obj` as the `start` argument. This allows the prototype to veto the property setting in case the prototype defines the property with [[ReadOnly]] attribute. If the property is not found, it is added in `obj`.

      参数:
        `obj` - a JavaScript object
        `name` - a property name
        `value` - any JavaScript value accepted by Scriptable.put
      从以下版本开始:
        1.5R2

    - #### putConstProperty

          public static void putConstProperty(org.mozilla.javascript.Scriptable obj,
                                              java.lang.String name,
                                              java.lang.Object value)

      Puts a named property in an object or in an object in its prototype chain.

      Searches for the named property in the prototype chain. If it is found, the value of the property in `obj` is changed through a call to `Scriptable.put(String, Scriptable, Object)` on the prototype passing `obj` as the `start` argument. This allows the prototype to veto the property setting in case the prototype defines the property with [[ReadOnly]] attribute. If the property is not found, it is added in `obj`.

      参数:
        `obj` - a JavaScript object
        `name` - a property name
        `value` - any JavaScript value accepted by Scriptable.put
      从以下版本开始:
        1.5R2

    - #### putProperty

          public static void putProperty(org.mozilla.javascript.Scriptable obj,
                                         int index,
                                         java.lang.Object value)

      Puts an indexed property in an object or in an object in its prototype chain.

      Searches for the indexed property in the prototype chain. If it is found, the value of the property in `obj` is changed through a call to `Scriptable.put(int, Scriptable, Object)` on the prototype passing `obj` as the `start` argument. This allows the prototype to veto the property setting in case the prototype defines the property with [[ReadOnly]] attribute. If the property is not found, it is added in `obj`.

      参数:
        `obj` - a JavaScript object
        `index` - a property index
        `value` - any JavaScript value accepted by Scriptable.put
      从以下版本开始:
        1.5R2

    - #### deleteProperty

          public static boolean deleteProperty(org.mozilla.javascript.Scriptable obj,
                                               java.lang.String name)

      Removes the property from an object or its prototype chain.

      Searches for a property with `name` in obj or its prototype chain. If it is found, the object's delete method is called.

      参数:
        `obj` - a JavaScript object
        `name` - a property name
      返回:
        true if the property doesn't exist or was successfully removed
      从以下版本开始:
        1.5R2

    - #### deleteProperty

          public static boolean deleteProperty(org.mozilla.javascript.Scriptable obj,
                                               int index)

      Removes the property from an object or its prototype chain.

      Searches for a property with `index` in obj or its prototype chain. If it is found, the object's delete method is called.

      参数:
        `obj` - a JavaScript object
        `index` - a property index
      返回:
        true if the property doesn't exist or was successfully removed
      从以下版本开始:
        1.5R2

    - #### getPropertyIds

          public static java.lang.Object[] getPropertyIds(org.mozilla.javascript.Scriptable obj)

      Returns an array of all ids from an object and its prototypes.

      参数:
        `obj` - a JavaScript object
      返回:
        an array of all ids from all object in the prototype chain. If a given id occurs multiple times in the prototype chain, it will occur only once in this list.
      从以下版本开始:
        1.5R2

    - #### callMethod

          public static java.lang.Object callMethod(org.mozilla.javascript.Scriptable obj,
                                                    java.lang.String methodName,
                                                    java.lang.Object[] args)

      Call a method of an object.
      参数:
        `obj` - the JavaScript object
        `methodName` - the name of the function property
        `args` - the arguments for the call
      另请参阅:
        `Context.getCurrentContext()`

    - #### callMethod

          public static java.lang.Object callMethod(Context cx,
                                                    org.mozilla.javascript.Scriptable obj,
                                                    java.lang.String methodName,
                                                    java.lang.Object[] args)

      Call a method of an object.
      参数:
        `cx` - the Context object associated with the current thread.
        `obj` - the JavaScript object
        `methodName` - the name of the function property
        `args` - the arguments for the call

    - #### getAssociatedValue

          public final java.lang.Object getAssociatedValue(java.lang.Object key)

      Get arbitrary application-specific value associated with this object.
      参数:
        `key` - key object to select particular value.
      另请参阅:
        `associateValue(Object key, Object value)`

    - #### getTopScopeValue

          public static java.lang.Object getTopScopeValue(org.mozilla.javascript.Scriptable scope,
                                                          java.lang.Object key)

      Get arbitrary application-specific value associated with the top scope of the given scope. The method first calls `getTopLevelScope(Scriptable scope)` and then searches the prototype chain of the top scope for the first object containing the associated value with the given key.
      参数:
        `scope` - the starting scope.
        `key` - key object to select particular value.
      另请参阅:
        `getAssociatedValue(Object key)`

    - #### associateValue

          public final java.lang.Object associateValue(java.lang.Object key,
                                                       java.lang.Object value)

      Associate arbitrary application-specific value with this object. Value can only be associated with the given object and key only once. The method ignores any subsequent attempts to change the already associated value.

      The associated values are not serialized.

      参数:
        `key` - key object to select particular value.
        `value` - the value to associate
      返回:
        the passed value if the method is called first time for the given key or old value for any subsequent calls.
      另请参阅:
        `getAssociatedValue(Object key)`

    - #### size

          public int size()

    - #### isEmpty

          public boolean isEmpty()

    - #### get

          public java.lang.Object get(java.lang.Object key)