public abstract class Location extends Object
Shape
,
Property
,
DynamicObject
Modifier | Constructor and Description |
---|---|
protected |
Location()
Constructor for subclasses.
|
Modifier and Type | Method and Description |
---|---|
boolean |
canSet(DynamicObject store,
Object value)
Returns
true if the location can be set to the given value. |
boolean |
canSet(Object value)
Returns
true if the location can be set to the value. |
boolean |
canStore(Object value)
Returns
true if the location is compatible with the type of the value. |
protected static boolean |
checkShape(DynamicObject store,
Shape shape)
Equivalent to
Shape.check(DynamicObject) . |
abstract boolean |
equals(Object obj)
Abstract to force overriding.
|
protected static FinalLocationException |
finalLocation() |
Object |
get(DynamicObject store)
Get object value as object at this location in store.
|
Object |
get(DynamicObject store,
boolean condition)
Get object value as object at this location in store.
|
Object |
get(DynamicObject store,
Shape shape)
Get object value as object at this location in store.
|
Assumption |
getFinalAssumption()
Returns the assumption that this location is final.
|
protected abstract Object |
getInternal(DynamicObject store) |
abstract int |
hashCode()
Abstract to force overriding.
|
protected static IncompatibleLocationException |
incompatibleLocation() |
boolean |
isAssumedFinal()
Returns
true if this location is assumed to be final. |
boolean |
isConstant()
Returns
true if this is a constant value location. |
boolean |
isDeclared()
Returns
true if this is a declared value location. |
boolean |
isFinal()
Returns
true if this is a final location, i.e. |
boolean |
isValue()
Returns
true if this is a value location. |
void |
set(DynamicObject store,
Object value)
Set object value at this location in store.
|
void |
set(DynamicObject store,
Object value,
Shape shape)
Set object value at this location in store.
|
void |
set(DynamicObject store,
Object value,
Shape oldShape,
Shape newShape)
Set object value at this location in store and update shape.
|
protected abstract void |
setInternal(DynamicObject store,
Object value)
Like
Location.set(DynamicObject, Object, Shape) , but does not invalidate final locations. |
protected static IncompatibleLocationException incompatibleLocation() throws IncompatibleLocationException
IncompatibleLocationException
protected static FinalLocationException finalLocation() throws FinalLocationException
FinalLocationException
public final Object get(DynamicObject store, Shape shape)
shape
- the current shape of the object, which must contain this locationpublic Object get(DynamicObject store, boolean condition)
Location.get(DynamicObject, Shape)
instead.condition
- the result of a shape check or false
Location.get(DynamicObject, Shape)
public final Object get(DynamicObject store)
public void set(DynamicObject store, Object value, Shape shape) throws IncompatibleLocationException, FinalLocationException
shape
- the current shape of the storage objectIncompatibleLocationException
- for storage type invalidationsFinalLocationException
- for effectively final fieldspublic void set(DynamicObject store, Object value, Shape oldShape, Shape newShape) throws IncompatibleLocationException
oldShape
- the shape before the transitionnewShape
- new shape after the transitionIncompatibleLocationException
- if value is of non-assignable typepublic final void set(DynamicObject store, Object value) throws IncompatibleLocationException, FinalLocationException
IncompatibleLocationException
- for storage type invalidationsFinalLocationException
- for effectively final fieldsprotected abstract Object getInternal(DynamicObject store)
protected abstract void setInternal(DynamicObject store, Object value) throws IncompatibleLocationException
Location.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.IncompatibleLocationException
- if value is of non-assignable typepublic boolean canSet(DynamicObject store, Object value)
true
if the location can be set to the given value.store
- the receiver objectvalue
- the value in questionpublic boolean canSet(Object value)
true
if the location can be set to the value.value
- the value in questionpublic boolean canStore(Object value)
true
if the location is compatible with the type of the value.
The actual value may still be rejected if Location.canSet(DynamicObject, Object)
returns
false.value
- the value in questionpublic boolean isFinal()
true
if this is a final location, i.e. readonly once set.public boolean isConstant()
true
if this is a constant value location.public abstract int hashCode()
public abstract boolean equals(Object obj)
public boolean isDeclared()
true
if this is a declared value location.public boolean isValue()
true
if this is a value location.Location.isConstant()
,
Location.isDeclared()
public boolean isAssumedFinal()
true
if this location is assumed to be final.Location.getFinalAssumption()
public Assumption getFinalAssumption()
Location.isAssumedFinal()
protected static boolean checkShape(DynamicObject store, Shape shape)
Shape.check(DynamicObject)
.