Package org.mozilla.javascript

## Class NativeSymbol

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

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

      public class NativeSymbol
      extends IdScriptableObject
      implements Symbol

  This is an implementation of the standard "Symbol" type that implements all of its weird properties. One of them is that some objects can have an "internal data slot" that makes them a Symbol and others cannot.
  See Also:
    Serialized Form

- - ### Nested Class Summary

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

      `ScriptableObject.KeyComparator`

  - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `static java.lang.String` | `CLASS_NAME` |
    `static java.lang.String` | `TYPE_NAME` |

    - ### 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 | Description
    --- | ---
    `NativeSymbol​(NativeSymbol s)` |

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `static NativeSymbol` | `construct​(Context cx, Scriptable scope, java.lang.Object[] args)` | Use this when we need to create symbols internally because of the convoluted way we have to construct them.
    `boolean` | `equals​(java.lang.Object x)` |
    `java.lang.Object` | `execIdCall​(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 void` | `fillConstructorProperties​(IdFunctionObject ctor)` |
    `protected int` | `findPrototypeId​(java.lang.String s)` |
    `protected int` | `findPrototypeId​(Symbol key)` |
    `java.lang.String` | `getClassName()` | Return the name of the class.
    `java.lang.String` | `getTypeOf()` | Gets the value that will be returned by calling the typeof operator on this object.
    `int` | `hashCode()` |
    `static void` | `init​(Context cx, Scriptable scope, boolean sealed)` |
    `protected void` | `initPrototypeId​(int id)` |
    `boolean` | `isSymbol()` | Object() on a Symbol constructs an object which is NOT a symbol, but which has an "internal data slot" that is.
    `void` | `put​(int index, Scriptable start, java.lang.Object value)` | Sets the value of the indexed property, creating it if need be.
    `void` | `put​(java.lang.String name, Scriptable start, java.lang.Object value)` | Sets the value of the named property, creating it if need be.
    `void` | `put​(Symbol key, Scriptable start, java.lang.Object value)` | Implementation of put required by SymbolScriptable objects.
    `java.lang.String` | `toString()` |

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

      `activatePrototypeMap, addIdFunctionProperty, defaultGet, defaultHas, defaultPut, defineOwnProperty, delete, delete, exportAsJSClass, findInstanceIdInfo, findInstanceIdInfo, get, get, getAttributes, getInstanceIdName, getInstanceIdValue, getMaxInstanceId, getOwnPropertyDescriptor, has, has, hasPrototypeMap, incompatibleCallError, initPrototypeConstructor, initPrototypeMethod, initPrototypeMethod, initPrototypeMethod, initPrototypeValue, initPrototypeValue, instanceIdInfo, setAttributes, setInstanceIdAttributes, setInstanceIdValue`

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

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

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

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### CLASS_NAME

          public static final java.lang.String CLASS_NAME

      See Also:
        Constant Field Values

    - #### TYPE_NAME

          public static final java.lang.String TYPE_NAME

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### NativeSymbol

          public NativeSymbol​(NativeSymbol s)

  - ### Method Detail

    - #### init

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

    - #### construct

          public static NativeSymbol construct​(Context cx,
                                               Scriptable scope,
                                               java.lang.Object[] args)

      Use this when we need to create symbols internally because of the convoluted way we have to construct them.

    - #### 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`

    - #### fillConstructorProperties

          protected void fillConstructorProperties​(IdFunctionObject ctor)

      Overrides:
        `fillConstructorProperties` in class `IdScriptableObject`

    - #### findPrototypeId

          protected int findPrototypeId​(java.lang.String s)

      Overrides:
        `findPrototypeId` in class `IdScriptableObject`

    - #### findPrototypeId

          protected int findPrototypeId​(Symbol key)

      Overrides:
        `findPrototypeId` in class `IdScriptableObject`

    - #### initPrototypeId

          protected void initPrototypeId​(int id)

      Overrides:
        `initPrototypeId` in class `IdScriptableObject`

    - #### execIdCall

          public 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:
        `execIdCall` in interface `IdFunctionCall`
      Overrides:
        `execIdCall` in class `IdScriptableObject`

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `java.lang.Object`

    - #### 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 `IdScriptableObject`
      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)`

    - #### put

          public void put​(int index,
                          Scriptable start,
                          java.lang.Object value)

      Description copied from class: `ScriptableObject`
      Sets the value of the indexed property, creating it if need be.
      Specified by:
        `put` in interface `Scriptable`
      Overrides:
        `put` in class `ScriptableObject`
      Parameters:
        `index` - the numeric index for the property
        `start` - the object whose property is being set
        `value` - value to set the property to
      See Also:
        `Scriptable.has(int, Scriptable)`, `Scriptable.get(int, Scriptable)`, `ScriptableObject.putProperty(Scriptable, int, Object)`, `Context.toObject(Object, Scriptable)`

    - #### put

          public void put​(Symbol key,
                          Scriptable start,
                          java.lang.Object value)

      Description copied from class: `ScriptableObject`
      Implementation of put required by SymbolScriptable objects.
      Specified by:
        `put` in interface `SymbolScriptable`
      Overrides:
        `put` in class `IdScriptableObject`

    - #### isSymbol

          public boolean isSymbol()

      Object() on a Symbol constructs an object which is NOT a symbol, but which has an "internal data slot" that is. Furthermore, such an object has the Symbol prototype so this particular object is still used. Account for that here: an "Object" that was created from a Symbol has a different value of the slot.

    - #### getTypeOf

          public java.lang.String getTypeOf()

      Description copied from class: `ScriptableObject`
      Gets the value that will be returned by calling the typeof operator on this object.
      Overrides:
        `getTypeOf` in class `ScriptableObject`
      Returns:
        default is "object" unless `ScriptableObject.avoidObjectDetection()` is `true` in which case it returns "undefined"

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `java.lang.Object`

    - #### equals

          public boolean equals​(java.lang.Object x)

      Overrides:
        `equals` in class `java.lang.Object`