Package com.oracle.truffle.api.object

## Class Location

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

All Implemented Interfaces:
  `BaseLocation`

Direct Known Subclasses:
  `LocationImpl`

    public abstract class Location
    extends java.lang.Object
    implements BaseLocation

Property location.

See Also:
  `Shape`, `Property`, `DynamicObject`

### Constructor Summary

Constructors
`Location()`

### Method Summary

All Methods Static Methods Instance Methods Abstract Methods Concrete Methods
`boolean` `canSet​(DynamicObject store, java.lang.Object value)` Returns `true` if the location can be set to the value.
`boolean` `canStore​(java.lang.Object value)` Returns `true` if the location is compatible with the value.
`protected static boolean` `checkShape​(DynamicObject store, Shape shape)`
`abstract boolean` `equals​(java.lang.Object obj)`
`protected static FinalLocationException` `finalLocation()`
`java.lang.Object` `get​(DynamicObject store, boolean condition)` Get object value as object at this location in store.
`java.lang.Object` `get​(DynamicObject store, Shape shape)` Get object value as object at this location in store.
`protected abstract java.lang.Object` `getInternal​(DynamicObject store)`
`abstract int` `hashCode()`
`protected static IncompatibleLocationException` `incompatibleLocation()`
`boolean` `isConstant()` Returns `true` if this is an immutable constant location.
`boolean` `isFinal()` Returns `true` if this is a final location, i.e.
`void` `set​(DynamicObject store, java.lang.Object value)` Set object value at this location in store.
`void` `set​(DynamicObject store, java.lang.Object value, Shape shape)` Set object value at this location in store.
`void` `set​(DynamicObject store, java.lang.Object value, Shape oldShape, Shape newShape)` Set object value at this location in store and update shape.
`protected abstract void` `setInternal​(DynamicObject store, java.lang.Object value)` Like `set(DynamicObject, Object, Shape)`, but does not invalidate final locations.

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

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

### Constructor Detail

#### Location

    public Location()

### Method Detail

#### incompatibleLocation

    protected static IncompatibleLocationException incompatibleLocation()
                                                                 throws IncompatibleLocationException

Throws:
  `IncompatibleLocationException`

#### finalLocation

    protected static FinalLocationException finalLocation()
                                                   throws FinalLocationException

Throws:
  `FinalLocationException`

#### get

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

Description copied from interface: `BaseLocation`
Get object value as object at this location in store.

Specified by:
  `get` in interface `BaseLocation`
  `shape` - the current shape of the object, which must contain this location

#### get

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

Description copied from interface: `BaseLocation`
Get object value as object at this location in store. For internal use only and subject to change, use `BaseLocation.get(DynamicObject, Shape)` instead.

Specified by:
  `get` in interface `BaseLocation`
  `condition` - the result of a shape check or `false`
See Also:
  `BaseLocation.get(DynamicObject, Shape)`

#### set

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

Description copied from interface: `BaseLocation`
Set object value at this location in store.

Specified by:
  `set` in interface `BaseLocation`
  `shape` - the current shape of the storage object
Throws:
  `IncompatibleLocationException` - for storage type invalidations
  `FinalLocationException` - for effectively final fields

#### set

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

Description copied from interface: `BaseLocation`
Set object value at this location in store and update shape.

Specified by:
  `set` in interface `BaseLocation`
  `oldShape` - the shape before the transition
  `newShape` - new shape after the transition
Throws:
  `IncompatibleLocationException` - if value is of non-assignable type

#### set

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

Description copied from interface: `BaseLocation`
Set object value at this location in store.

Specified by:
  `set` in interface `BaseLocation`
Throws:
  `IncompatibleLocationException` - for storage type invalidations
  `FinalLocationException` - for effectively final fields

#### getInternal

    protected abstract java.lang.Object getInternal​(DynamicObject store)

#### setInternal

    protected abstract void setInternal​(DynamicObject store,
                                        java.lang.Object value)
                                 throws IncompatibleLocationException

Like `set(DynamicObject, Object, Shape)`, but does not invalidate final locations. For internal use only and subject to change, use `DynamicObjectFactory` to create objects with predefined properties.

Throws:
  `IncompatibleLocationException` - if value is of non-assignable type

#### canSet

    public boolean canSet​(DynamicObject store,
                          java.lang.Object value)

Returns `true` if the location can be set to the value.

Parameters:
  `store` - the receiver object
  `value` - the value in question

#### canStore

    public boolean canStore​(java.lang.Object value)

Returns `true` if the location is compatible with the value. The value may still be rejected if `canSet(DynamicObject, Object)` returns false.

Parameters:
  `value` - the value in question

#### isFinal

    public boolean isFinal()

Returns `true` if this is a final location, i.e. readonly once set.

#### isConstant

    public boolean isConstant()

Returns `true` if this is an immutable constant location.

#### hashCode

    public abstract int hashCode()

Overrides:
  `hashCode` in class `java.lang.Object`

#### equals

    public abstract boolean equals​(java.lang.Object obj)

Overrides:
  `equals` in class `java.lang.Object`

#### checkShape

    protected static boolean checkShape​(DynamicObject store,
                                        Shape shape)