Module org.mozilla.rhino
Package org.mozilla.javascript
Class BuiltInSlot<T extends ScriptableObject>
java.lang.Object
org.mozilla.javascript.Slot
org.mozilla.javascript.BuiltInSlot<T>
- All Implemented Interfaces:
Serializable
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 interfaceBuiltInSlot.Getter<U extends ScriptableObject>static interfacestatic interfaceBuiltInSlot.Setter<U extends ScriptableObject> -
Method Summary
Modifier and TypeMethodDescriptiongetValue(Scriptable start) booleansetValue(Object value, Scriptable owner, Scriptable start, boolean isThrow) voidsetValueFromDescriptor(Object value, Scriptable owner, Scriptable start, boolean isThrow) Methods inherited from class org.mozilla.javascript.Slot
setValue, throwNoSetterException
-
Method Details
-
getValue
-
setValue
-
setValueFromDescriptor
public void setValueFromDescriptor(Object value, Scriptable owner, Scriptable start, boolean isThrow)
-