Package org.mozilla.javascript
Class NativeSymbol
java.lang.Object
org.mozilla.javascript.ScriptableObject
org.mozilla.javascript.NativeSymbol
- All Implemented Interfaces:
Serializable
,ConstProperties
,DebuggableObject
,Scriptable
,Symbol
,SymbolScriptable
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:
-
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
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Return the name of the class.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) 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, Object value) Sets the value of the indexed property, creating it if need be.void
put
(String name, Scriptable start, Object value) Sets the value of the named property, creating it if need be.void
put
(Symbol key, Scriptable start, Object value) Implementation of put required by SymbolScriptable objects.toString()
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, defineProperty, defineProperty, delete, delete, delete, deleteProperty, deleteProperty, ensureScriptable, ensureScriptableObject, ensureSymbolScriptable, equivalentValues, get, 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, getTopLevelScope, getTopScopeValue, getTypedProperty, getTypedProperty, has, has, has, hasInstance, hasProperty, hasProperty, hasProperty, isAccessorDescriptor, isConst, isDataDescriptor, isEmpty, isExtensible, isFalse, isGenericDescriptor, isGetterOrSetter, isSealed, isTrue, preventExtensions, putConst, putConstProperty, putProperty, putProperty, putProperty, querySlot, redefineProperty, sameValue, sealObject, setAttributes, setAttributes, setAttributes, setAttributes, setAttributes, setCommonDescriptorProperties, setExternalArrayData, setGetterOrSetter, setParentScope, setPrototype, size
-
Field Details
-
CLASS_NAME
- See Also:
-
TYPE_NAME
- See Also:
-
-
Constructor Details
-
NativeSymbol
-
-
Method Details
-
init
-
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 interfaceScriptable
- Specified by:
getClassName
in classScriptableObject
-
toString
-
put
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 interfaceScriptable
- Overrides:
put
in classScriptableObject
- Parameters:
name
- the name of the propertystart
- the object whose property is being setvalue
- value to set the property to- See Also:
-
put
Description copied from class:ScriptableObject
Sets the value of the indexed property, creating it if need be.- Specified by:
put
in interfaceScriptable
- Overrides:
put
in classScriptableObject
- Parameters:
index
- the numeric index for the propertystart
- the object whose property is being setvalue
- value to set the property to- See Also:
-
put
Description copied from class:ScriptableObject
Implementation of put required by SymbolScriptable objects.- Specified by:
put
in interfaceSymbolScriptable
- Overrides:
put
in classScriptableObject
-
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
Description copied from class:ScriptableObject
Gets the value that will be returned by calling the typeof operator on this object.- Overrides:
getTypeOf
in classScriptableObject
- Returns:
- default is "object" unless
ScriptableObject.avoidObjectDetection()
istrue
in which case it returns "undefined"
-
hashCode
public int hashCode() -
equals
-