Module org.htmlunit.corejs
Package org.htmlunit.corejs.javascript
Class SlotMapOwner<T extends PropHolder<T>>
java.lang.Object
org.htmlunit.corejs.javascript.SlotMapOwner<T>
- All Implemented Interfaces:
PropHolder<T>
- Direct Known Subclasses:
ScopeObject,ScriptableObject
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedprotectedSlotMapOwner(int capacity) protectedSlotMapOwner(SlotMap<T> map) -
Method Summary
Modifier and TypeMethodDescriptionfinal ObjectassociateValue(Object key, Object value) Associate arbitrary application-specific value with this object.protected voidcheckNotSealed(Object key, int index) protected voidcopyAssociatedValue(SlotMapOwner<T> other) protected static <T extends PropHolder<T>>
SlotMap<T>createSlotMap(int initialSize) protected static <T extends PropHolder<T>,O extends ScriptableObject>
SlotMap<T>createSlotMap(CompactSlot<?, T, O> slot0, CompactSlot<?, T, O> slot1, CompactSlot<?, T, O> slot2, CompactSlot<?, T, O> slot3) voiddefineProperty(String propertyName, Object value, int attributes) Define a JavaScript property.voiddefineProperty(Symbol key, Object value, int attributes) A version of defineProperty that uses a Symbol key.voiddelete(int index) voidvoidReturns the value of the indexed property or NOT_FOUND.Returns the value of the named property or NOT_FOUND.Another version of Get that supports Symbol keyed properties.final ObjectgetAssociatedValue(Object key) Get arbitrary application-specific value associated with this object.intgetAttributes(int index) Get the attributes of an indexed property.final intgetAttributes(int index, Scriptable start) Deprecated.intgetAttributes(String name) Get the attributes of a named property.final intgetAttributes(String name, Scriptable start) Deprecated.intgetAttributes(Symbol sym) Object[]getIds()Returns an array of ids for the properties of the object.abstract TgetThis()booleanReturns true if the property index is defined.booleanReturns true if the named property is defined.booleanA version of "has" that supports symbols.final booleanisSealed()Return true if this object is sealed.voidvoidvoidprotected voidvoidvoidsetAttributes(int index, int attributes) Set the attributes of an indexed property.voidsetAttributes(int index, Scriptable start, int attributes) Deprecated.voidsetAttributes(String name, int attributes) Set the attributes of a named property.final voidsetAttributes(String name, Scriptable start, int attributes) Deprecated.voidsetAttributes(Symbol key, int attributes) Set attributes of a Symbol-keyed property.protected voidMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.htmlunit.corejs.javascript.PropHolder
getAncestor
-
Field Details
-
isSealed
protected boolean isSealed
-
-
Constructor Details
-
SlotMapOwner
protected SlotMapOwner() -
SlotMapOwner
protected SlotMapOwner(int capacity) -
SlotMapOwner
-
-
Method Details
-
createSlotMap
-
createSlotMap
protected static <T extends PropHolder<T>,O extends ScriptableObject> SlotMap<T> createSlotMap(CompactSlot<?, T, O> slot0, CompactSlot<?, T, O> slot1, CompactSlot<?, T, O> slot2, CompactSlot<?, T, O> slot3) -
has
Returns true if the named property is defined.- Specified by:
hasin interfacePropHolder<T extends PropHolder<T>>- Parameters:
name- the name of the propertystart- the object in which the lookup began- Returns:
- true if and only if the property was found in the object
-
has
Returns true if the property index is defined.- Specified by:
hasin interfacePropHolder<T extends PropHolder<T>>- Parameters:
index- the numeric index for the propertystart- the object in which the lookup began- Returns:
- true if and only if the property was found in the object
-
has
A version of "has" that supports symbols.- Specified by:
hasin interfacePropHolder<T extends PropHolder<T>>
-
get
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:
getin interfacePropHolder<T extends PropHolder<T>>- Parameters:
name- the name of the propertystart- the object in which the lookup began- Returns:
- the value of the property (may be null), or NOT_FOUND
-
get
Returns the value of the indexed property or NOT_FOUND.- Specified by:
getin interfacePropHolder<T extends PropHolder<T>>- Parameters:
index- the numeric index for the propertystart- the object in which the lookup began- Returns:
- the value of the property (may be null), or NOT_FOUND
-
get
Another version of Get that supports Symbol keyed properties.- Specified by:
getin interfacePropHolder<T extends PropHolder<T>>
-
put
- Specified by:
putin interfacePropHolder<T extends PropHolder<T>>
-
put
- Specified by:
putin interfacePropHolder<T extends PropHolder<T>>
-
put
- Specified by:
putin interfacePropHolder<T extends PropHolder<T>>
-
delete
- Specified by:
deletein interfacePropHolder<T extends PropHolder<T>>
-
delete
public void delete(int index) - Specified by:
deletein interfacePropHolder<T extends PropHolder<T>>
-
delete
- Specified by:
deletein interfacePropHolder<T extends PropHolder<T>>
-
getAssociatedValue
Get arbitrary application-specific value associated with this object.- Parameters:
key- key object to select particular value.- See Also:
-
copyAssociatedValue
-
associateValue
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.
- Parameters:
key- key object to select particular value.value- the value to associate- Returns:
- the passed value if the method is called first time for the given key or old value for any subsequent calls.
- See Also:
-
isSealed
public final boolean isSealed()Return true if this object is sealed.- Returns:
- true if sealed, false otherwise.
- Since:
- 1.4R3
- See Also:
-
sealObject
public void sealObject() -
checkNotSealed
-
getAttributes
Deprecated.UsegetAttributes(String name). The engine always ignored the start argument. -
getAttributes
Deprecated.UsegetAttributes(int index). The engine always ignored the start argument. -
setAttributes
Deprecated.UsesetAttributes(String name, int attributes). The engine always ignored the start argument. -
setAttributes
Deprecated.UsesetAttributes(int index, int attributes). The engine always ignored the start argument. -
getAttributes
Get the attributes of a named property.The property is specified by
nameas defined forhas.- Parameters:
name- the identifier for the property- Returns:
- the bitset of attributes
- Throws:
EvaluatorException- if the named property is not found- See Also:
-
getAttributes
public int getAttributes(int index) Get the attributes of an indexed property.- Parameters:
index- the numeric index for the property- Returns:
- the bitset of attributes
- Throws:
EvaluatorException- if the named property is not found is not found- See Also:
-
getAttributes
-
setAttributes
Set the attributes of a named property.The property is specified by
nameas defined forhas.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.
- Parameters:
name- the name of the propertyattributes- the bitset of attributes- Throws:
EvaluatorException- if the named property is not found- See Also:
-
setAttributes
public void setAttributes(int index, int attributes) Set the attributes of an indexed property.- Parameters:
index- the numeric index for the propertyattributes- the bitset of attributes- Throws:
EvaluatorException- if the named property is not found- See Also:
-
setAttributes
Set attributes of a Symbol-keyed property. -
writeMaps
- Throws:
IOException
-
readMaps
- Throws:
IOExceptionClassNotFoundException
-
defineProperty
Define a JavaScript property.Creates the property with an initial value and sets its attributes.
- Parameters:
propertyName- the name of the property to define.value- the initial value of the propertyattributes- the attributes of the JavaScript property- See Also:
-
defineProperty
A version of defineProperty that uses a Symbol key.- Parameters:
key- symbol of the property to define.value- the initial value of the propertyattributes- the attributes of the JavaScript property
-
getIds
Returns an array of ids for the properties of the object.Any properties with the attribute DONTENUM are not listed.
- Specified by:
getIdsin interfacePropHolder<T extends PropHolder<T>>- 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.
-
getThis
-
getAttributes(int index).