Class BuiltInSlot<T extends ScriptableObject>

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:
  • Method Details

    • setValueFromDescriptor

      public void setValueFromDescriptor(Object value, Scriptable owner, Scriptable start, boolean isThrow)