Package org.rapidcontext.core.js
Class ArrayWrapper
java.lang.Object
org.mozilla.javascript.ScriptableObject
org.rapidcontext.core.js.ArrayWrapper
- All Implemented Interfaces:
Serializable
,org.mozilla.javascript.ConstProperties
,org.mozilla.javascript.debug.DebuggableObject
,org.mozilla.javascript.Scriptable
,org.mozilla.javascript.SymbolScriptable
,org.mozilla.javascript.Wrapper
public final class ArrayWrapper
extends org.mozilla.javascript.ScriptableObject
implements org.mozilla.javascript.Wrapper
A JavaScript array wrapper. This class encapsulates an array and
forwards all reads and modifications.
- Version:
- 1.0
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.mozilla.javascript.ScriptableObject
org.mozilla.javascript.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
ConstructorsConstructorDescriptionArrayWrapper
(Array arr, org.mozilla.javascript.Scriptable parentScope) Creates a new JavaScript array wrapper. -
Method Summary
Modifier and TypeMethodDescriptionvoid
delete
(int index) Removes an indexed property from this object.get
(int index, org.mozilla.javascript.Scriptable start) Returns an indexed property from this object.Returns a named property from this object.Returns the class name.boolean
has
(int index, org.mozilla.javascript.Scriptable start) Checks if an index is defined in this object.boolean
hasInstance
(org.mozilla.javascript.Scriptable instance) Checks for JavaScript instance objects (always returns false).void
Sets an indexed property in this object.void
Sets a property in this object.unwrap()
Returns the wrapped object.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, delete, delete, deleteProperty, deleteProperty, ensureScriptable, ensureScriptableObject, ensureSymbolScriptable, equivalentValues, 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, getTypeOf, has, has, hasProperty, hasProperty, hasProperty, isAccessorDescriptor, isConst, isDataDescriptor, isEmpty, isExtensible, isFalse, isGenericDescriptor, isGetterOrSetter, isSealed, isTrue, preventExtensions, put, putConst, putConstProperty, putProperty, putProperty, putProperty, querySlot, redefineProperty, sameValue, sealObject, setAttributes, setAttributes, setAttributes, setAttributes, setAttributes, setCommonDescriptorProperties, setExternalArrayData, setGetterOrSetter, setParentScope, setPrototype, size
-
Constructor Details
-
ArrayWrapper
Creates a new JavaScript array wrapper.- Parameters:
arr
- the array objectparentScope
- the object parent scope
-
-
Method Details
-
getClassName
Returns the class name.- Specified by:
getClassName
in interfaceorg.mozilla.javascript.Scriptable
- Specified by:
getClassName
in classorg.mozilla.javascript.ScriptableObject
- Returns:
- the class name
-
hasInstance
public boolean hasInstance(org.mozilla.javascript.Scriptable instance) Checks for JavaScript instance objects (always returns false).- Specified by:
hasInstance
in interfaceorg.mozilla.javascript.Scriptable
- Overrides:
hasInstance
in classorg.mozilla.javascript.ScriptableObject
- Parameters:
instance
- the object to check- Returns:
- always returns false (no instances possible)
-
has
public boolean has(int index, org.mozilla.javascript.Scriptable start) Checks if an index is defined in this object.- Specified by:
has
in interfaceorg.mozilla.javascript.Scriptable
- Overrides:
has
in classorg.mozilla.javascript.ScriptableObject
- Parameters:
index
- the index of the propertystart
- the object in which the lookup began- Returns:
- true if the index is defined, or false otherwise
-
get
Returns a named property from this object.- Specified by:
get
in interfaceorg.mozilla.javascript.Scriptable
- Overrides:
get
in classorg.mozilla.javascript.ScriptableObject
- Parameters:
name
- the name of the propertystart
- the object in which the lookup began- Returns:
- the value of the property, or NOT_FOUND if not found
-
get
Returns an indexed property from this object.- Specified by:
get
in interfaceorg.mozilla.javascript.Scriptable
- Overrides:
get
in classorg.mozilla.javascript.ScriptableObject
- Parameters:
index
- the index of the propertystart
- the object in which the lookup began- Returns:
- the value of the property, or NOT_FOUND if not found
-
put
Sets a property in this object.- Specified by:
put
in interfaceorg.mozilla.javascript.Scriptable
- Overrides:
put
in classorg.mozilla.javascript.ScriptableObject
- Parameters:
name
- the name of the propertystart
- the object in which the lookup beganvalue
- the value to set
-
put
Sets an indexed property in this object.- Specified by:
put
in interfaceorg.mozilla.javascript.Scriptable
- Overrides:
put
in classorg.mozilla.javascript.ScriptableObject
- Parameters:
index
- the index of the propertystart
- the object in which the lookup beganvalue
- the value to set
-
delete
public void delete(int index) Removes an indexed property from this object.- Specified by:
delete
in interfaceorg.mozilla.javascript.Scriptable
- Overrides:
delete
in classorg.mozilla.javascript.ScriptableObject
- Parameters:
index
- the index of the property
-
unwrap
Returns the wrapped object. Recursively replaces all JavaScript classes inside values and replaces them with the corresponding Java objects.- Specified by:
unwrap
in interfaceorg.mozilla.javascript.Wrapper
- Returns:
- the unwrapped object
-