Package com.oracle.truffle.api.object
Interface DynamicObject
-
- All Superinterfaces:
TypedObject
- All Known Implementing Classes:
DynamicObjectBasic
,DynamicObjectImpl
public interface DynamicObject extends TypedObject
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
DynamicObject.FlagsFunction
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
changeFlags(java.lang.Object key, int newFlags)
Change property flags.boolean
changeFlags(java.lang.Object key, DynamicObject.FlagsFunction flagsUpdateFunction)
Change property flags.void
define(java.lang.Object key, java.lang.Object value, int flags)
Define new property or redefine existing property.void
define(java.lang.Object key, java.lang.Object value, int flags, LocationFactory locationFactory)
Define new property with a static location or change existing property.boolean
delete(java.lang.Object key)
Delete property.java.lang.Object
get(java.lang.Object key, java.lang.Object defaultValue)
Get property value.Shape
getShape()
Get the object's current shape.boolean
isEmpty()
Returnstrue
if this object contains no properties.boolean
set(java.lang.Object key, java.lang.Object value)
Set value of existing property.void
setShapeAndGrow(Shape oldShape, Shape newShape)
Set object shape and grow storage if necessary.void
setShapeAndResize(Shape oldShape, Shape newShape)
Set object shape and resize storage if necessary.int
size()
Returns the number of properties in this object.boolean
updateShape()
Ensure object shape is up-to-date.-
Methods inherited from interface com.oracle.truffle.api.TypedObject
getTypeIdentifier
-
-
-
-
Method Detail
-
getShape
Shape getShape()
Get the object's current shape.
-
get
java.lang.Object get(java.lang.Object key, java.lang.Object defaultValue)
Get property value.- Parameters:
key
- property identifierdefaultValue
- return value if property is not found- Returns:
- property value or defaultValue if object has no such property
-
set
boolean set(java.lang.Object key, java.lang.Object value)
Set value of existing property.- Parameters:
key
- property identifiervalue
- value to be set- Returns:
true
if successful orfalse
if property not found
-
define
void define(java.lang.Object key, java.lang.Object value, int flags)
Define new property or redefine existing property.- Parameters:
key
- property identifiervalue
- value to be setflags
- flags to be set
-
define
void define(java.lang.Object key, java.lang.Object value, int flags, LocationFactory locationFactory)
Define new property with a static location or change existing property.- Parameters:
key
- property identifiervalue
- value to be setflags
- flags to be setlocationFactory
- factory function that creates a location for a given shape and value
-
changeFlags
boolean changeFlags(java.lang.Object key, int newFlags)
Change property flags.- Parameters:
key
- property identifiernewFlags
- flags to be set- Returns:
true
if successful orfalse
if property not found
-
changeFlags
boolean changeFlags(java.lang.Object key, DynamicObject.FlagsFunction flagsUpdateFunction)
Change property flags.- Parameters:
key
- property identifierflagsUpdateFunction
- function updating old flags to new flags- Returns:
true
if successful orfalse
if property not found
-
delete
boolean delete(java.lang.Object key)
Delete property.- Parameters:
key
- property identifier- Returns:
true
if successful orfalse
if property not found
-
size
int size()
Returns the number of properties in this object.
-
isEmpty
boolean isEmpty()
Returnstrue
if this object contains no properties.
-
setShapeAndGrow
void setShapeAndGrow(Shape oldShape, Shape newShape)
Set object shape and grow storage if necessary.- Parameters:
oldShape
- the object's current shape (must equalgetShape()
)newShape
- the new shape to be set
-
setShapeAndResize
void setShapeAndResize(Shape oldShape, Shape newShape)
Set object shape and resize storage if necessary.- Parameters:
oldShape
- the object's current shape (must equalgetShape()
)newShape
- the new shape to be set
-
updateShape
boolean updateShape()
Ensure object shape is up-to-date.- Returns:
true
if shape has changed
-
-