Package com.oracle.truffle.api.object

## Class Property

- java.lang.Object
- - com.oracle.truffle.api.object.Property

Direct Known Subclasses:
  `PropertyImpl`

    public abstract class Property
    extends java.lang.Object

Property objects represent the mapping between low-level stores and high-level data. The simplest Property could be nothing more than a map of one index to one property's value, but abstracting the interface allows for getter/setter methods, type-checked properties, and other such specialized and language-specific behavior. ECMAScript[8.6.1]

### Constructor Summary

Constructors
`protected` `Property()`

### Method Summary

All Methods Static Methods Instance Methods Abstract Methods Concrete Methods
`abstract Property` `copyWithFlags​(int newFlags)` Create a copy of the property with the given flags.
`abstract Property` `copyWithRelocatable​(boolean newRelocatable)`
`static Property` `create​(java.lang.Object key, Location location, int flags)`
`abstract java.lang.Object` `get​(DynamicObject store, boolean condition)` Gets the value of this property of the object.
`abstract java.lang.Object` `get​(DynamicObject store, Shape shape)` Gets the value of this property of the object.
`abstract int` `getFlags()` Get property flags.
`abstract java.lang.Object` `getKey()` Get property identifier.
`abstract Location` `getLocation()` Get the property location.
`abstract boolean` `isHidden()` Is this property hidden from iteration.
`abstract boolean` `isSame​(Property other)` Returns `true` if this property and some other property have the same key and flags.
`abstract boolean` `isShadow()`
`abstract Property` `relocate​(Location newLocation)` Change the property's location.
`abstract void` `set​(DynamicObject store, java.lang.Object value, Shape shape)` Assigns value to this property of the object.
`abstract void` `set​(DynamicObject store, java.lang.Object value, Shape oldShape, Shape newShape)` Assigns value to this property of the object, changing the object's shape.
`abstract void` `setGeneric​(DynamicObject store, java.lang.Object value, Shape shape)` Assigns value to this property of the object.
`abstract void` `setGeneric​(DynamicObject store, java.lang.Object value, Shape oldShape, Shape newShape)` Assigns value to this property of the object, changing the object's shape.
`abstract void` `setInternal​(DynamicObject store, java.lang.Object value)` Like `setSafe(com.oracle.truffle.api.object.DynamicObject, java.lang.Object, com.oracle.truffle.api.object.Shape)`, but ignores the finalness of the property.
`abstract void` `setSafe​(DynamicObject store, java.lang.Object value, Shape shape)` Like `set(DynamicObject, Object, Shape)`, but throws an `IllegalStateException` instead.
`abstract void` `setSafe​(DynamicObject store, java.lang.Object value, Shape oldShape, Shape newShape)` Assigns value to this property of the object, changing the object's shape.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### Property

    protected Property()

### Method Detail

#### create

    public static Property create​(java.lang.Object key,
                                  Location location,
                                  int flags)

#### getKey

    public abstract java.lang.Object getKey()

Get property identifier.

#### getFlags

    public abstract int getFlags()

Get property flags.

#### relocate

    public abstract Property relocate​(Location newLocation)

Change the property's location.

Returns:
  a Property with the new location (or `this` if the location is unchanged).

#### get

    public abstract java.lang.Object get​(DynamicObject store,
                                         Shape shape)

Gets the value of this property of the object.

Parameters:
  `store` - the store that this property resides in
  `shape` - the current shape of the object, which must contain this location
See Also:
  `DynamicObject.get(Object, Object)`

#### get

    public abstract java.lang.Object get​(DynamicObject store,
                                         boolean condition)

Gets the value of this property of the object.

Parameters:
  `store` - the store that this property resides in
  `condition` - the result of a shape check or `false`
See Also:
  `DynamicObject.get(Object, Object)`, `get(DynamicObject, Shape)`

#### set

    public abstract void set​(DynamicObject store,
                             java.lang.Object value,
                             Shape shape)
                      throws IncompatibleLocationException,
                             FinalLocationException

Assigns value to this property of the object. Throws an exception if the value cannot be assigned to the property's current location.

Parameters:
  `store` - the store that this property resides in
  `value` - the value to assign
  `shape` - the current shape of the object or `null`
Throws:
  `IncompatibleLocationException` - if the value is incompatible with the property location
  `FinalLocationException` - if the location is final and values differ
See Also:
  `DynamicObject.set(Object, Object)`

#### setGeneric

    public abstract void setGeneric​(DynamicObject store,
                                    java.lang.Object value,
                                    Shape shape)

Assigns value to this property of the object. Automatically relocates the property if the value cannot be assigned to its current location.

Parameters:
  `shape` - the current shape of the object or `null`

#### setSafe

    public abstract void setSafe​(DynamicObject store,
                                 java.lang.Object value,
                                 Shape shape)

Like `set(DynamicObject, Object, Shape)`, but throws an `IllegalStateException` instead.

#### setInternal

    public abstract void setInternal​(DynamicObject store,
                                     java.lang.Object value)

Like `setSafe(com.oracle.truffle.api.object.DynamicObject, java.lang.Object, com.oracle.truffle.api.object.Shape)`, but ignores the finalness of the property. For internal use only.

Parameters:
  `store` - the store that this property resides in
  `value` - the value to assign

#### set

    public abstract void set​(DynamicObject store,
                             java.lang.Object value,
                             Shape oldShape,
                             Shape newShape)
                      throws IncompatibleLocationException

Assigns value to this property of the object, changing the object's shape. Combines `DynamicObject.setShapeAndGrow(Shape, Shape)` and `set(DynamicObject, Object, Shape)` to an atomic operation.

Parameters:
  `store` - the store that this property resides in
  `value` - the value to assign
  `oldShape` - the shape before the transition
  `newShape` - the shape after the transition
Throws:
  `IncompatibleLocationException` - if the value is incompatible with the property location

#### setGeneric

    public abstract void setGeneric​(DynamicObject store,
                                    java.lang.Object value,
                                    Shape oldShape,
                                    Shape newShape)

Assigns value to this property of the object, changing the object's shape. Combines `DynamicObject.setShapeAndGrow(Shape, Shape)` and `setGeneric(DynamicObject, Object, Shape)` to an atomic operation.

Parameters:
  `store` - the store that this property resides in
  `value` - the value to assign
  `oldShape` - the shape before the transition
  `newShape` - the shape after the transition

#### setSafe

    public abstract void setSafe​(DynamicObject store,
                                 java.lang.Object value,
                                 Shape oldShape,
                                 Shape newShape)

Assigns value to this property of the object, changing the object's shape. Combines `DynamicObject.setShapeAndGrow(Shape, Shape)` and `setSafe(DynamicObject, Object, Shape)` to an atomic operation.

Parameters:
  `store` - the store that this property resides in
  `value` - the value to assign
  `oldShape` - the shape before the transition
  `newShape` - the shape after the transition

#### isSame

    public abstract boolean isSame​(Property other)

Returns `true` if this property and some other property have the same key and flags.

#### getLocation

    public abstract Location getLocation()

Get the property location.

#### isHidden

    public abstract boolean isHidden()

Is this property hidden from iteration.

See Also:
  `HiddenKey`

#### isShadow

    public abstract boolean isShadow()

#### copyWithFlags

    public abstract Property copyWithFlags​(int newFlags)

Create a copy of the property with the given flags.

#### copyWithRelocatable

    public abstract Property copyWithRelocatable​(boolean newRelocatable)