Package com.oracle.truffle.api.object
Interface DynamicObject
- All Superinterfaces:
TypedObject
- All Known Implementing Classes:
DynamicObjectBasic
,DynamicObjectImpl
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionboolean
changeFlags
(Object key, int newFlags) Change property flags.boolean
changeFlags
(Object key, DynamicObject.FlagsFunction flagsUpdateFunction) Change property flags.void
Define new property or redefine existing property.void
define
(Object key, Object value, int flags, LocationFactory locationFactory) Define new property with a static location or change existing property.boolean
Delete property.Get property value.getShape()
Get the object's current shape.boolean
isEmpty()
Returnstrue
if this object contains no properties.boolean
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
Ensure object shape is up-to-date.Methods inherited from interface com.oracle.truffle.api.TypedObject
getTypeIdentifier
-
Method Details
-
getShape
Shape getShape()Get the object's current shape. -
get
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
Set value of existing property.- Parameters:
key
- property identifiervalue
- value to be set- Returns:
true
if successful orfalse
if property not found
-
define
Define new property or redefine existing property.- Parameters:
key
- property identifiervalue
- value to be setflags
- flags to be set
-
define
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
Change property flags.- Parameters:
key
- property identifiernewFlags
- flags to be set- Returns:
true
if successful orfalse
if property not found
-
changeFlags
Change property flags.- Parameters:
key
- property identifierflagsUpdateFunction
- function updating old flags to new flags- Returns:
true
if successful orfalse
if property not found
-
delete
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
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
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
-