public abstract class Location extends java.lang.Object implements BaseLocation
Shape
,
Property
,
DynamicObject
Constructor and Description |
---|
Location() |
Modifier and Type | Method and Description |
---|---|
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. |
protected static IncompatibleLocationException incompatibleLocation() throws IncompatibleLocationException
IncompatibleLocationException
protected static FinalLocationException finalLocation() throws FinalLocationException
FinalLocationException
public final java.lang.Object get(DynamicObject store, Shape shape)
BaseLocation
get
in interface BaseLocation
shape
- the current shape of the object, which must contain this locationpublic java.lang.Object get(DynamicObject store, boolean condition)
BaseLocation
BaseLocation.get(DynamicObject, Shape)
instead.get
in interface BaseLocation
condition
- the result of a shape check or false
BaseLocation.get(DynamicObject, Shape)
public void set(DynamicObject store, java.lang.Object value, Shape shape) throws IncompatibleLocationException, FinalLocationException
BaseLocation
set
in interface BaseLocation
shape
- the current shape of the storage objectIncompatibleLocationException
- for storage type invalidationsFinalLocationException
- for effectively final fieldspublic final void set(DynamicObject store, java.lang.Object value, Shape oldShape, Shape newShape) throws IncompatibleLocationException
BaseLocation
set
in interface BaseLocation
oldShape
- the shape before the transitionnewShape
- new shape after the transitionIncompatibleLocationException
- if value is of non-assignable typepublic final void set(DynamicObject store, java.lang.Object value) throws IncompatibleLocationException, FinalLocationException
BaseLocation
set
in interface BaseLocation
IncompatibleLocationException
- for storage type invalidationsFinalLocationException
- for effectively final fieldsprotected abstract java.lang.Object getInternal(DynamicObject store)
protected abstract void setInternal(DynamicObject store, java.lang.Object value) throws IncompatibleLocationException
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, java.lang.Object value)
true
if the location can be set to the value.store
- the receiver objectvalue
- the value in questionpublic boolean canStore(java.lang.Object value)
true
if the location is compatible with the value.
The value may still be rejected if 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 an immutable constant location.public abstract int hashCode()
hashCode
in class java.lang.Object
public abstract boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
protected static boolean checkShape(DynamicObject store, Shape shape)