Module org.htmlunit.corejs
Package org.htmlunit.corejs.javascript
Class BuiltInSlot<T extends ScriptableObject>
java.lang.Object
org.htmlunit.corejs.javascript.Slot<U>
org.htmlunit.corejs.javascript.CompactSlot<BuiltInSlot.Descriptor<T>,Scriptable,T>
org.htmlunit.corejs.javascript.BuiltInSlot<T>
- All Implemented Interfaces:
Serializable
public class BuiltInSlot<T extends ScriptableObject>
extends CompactSlot<BuiltInSlot.Descriptor<T>,Scriptable,T>
This is a specialization of property access using some lambda functions designed for properties
on built in objects that may be created extremely frequently. It is designed to expose a field on
a native Java object as a property via static methods that can get and set this value. Custom
operations are also supported for the setting of property attributes (as the class may need to
check these during internal operations) and redefinition of the property via a descriptor (as
array length has unusual behaviour in this respect).
It will generate a plain data descriptor when a property descriptor is produced from it, as the properties we might want to internalise do not necessarily have get and set functions.
Holding the `owner` on this object and passing it to the various accessor functions was a design choice to reduce object creation under the current slot implementation, and to facilitate the separation of slots and descriptors in future.
The owner must be held specifically as the current slot APIs do not pass in the owner of the map from which a slot was fetched. We store it in the slot's value field as this is not used for any real value storage on a built in slot.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceBuiltInSlot.AttributeSetter<U extends ScriptableObject>static classBuiltInSlot.Descriptor<T extends ScriptableObject>static interfaceBuiltInSlot.Getter<T extends ScriptableObject>static interfacestatic interfaceBuiltInSlot.Setter<T extends ScriptableObject> -
Field Summary
Fields inherited from class org.htmlunit.corejs.javascript.CompactSlot
descriptor -
Method Summary
Modifier and TypeMethodDescriptionvoidsetValueFromDescriptor(Object value, Scriptable owner, Scriptable start, boolean isThrow) Methods inherited from class org.htmlunit.corejs.javascript.CompactSlot
getIndexOrHash, getKey, getName, getRawValue, getValue, keyMatches, setRawValue, setValue, throwNoSetterException
-
Method Details
-
setValueFromDescriptor
public void setValueFromDescriptor(Object value, Scriptable owner, Scriptable start, boolean isThrow)
-