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 TypeMethodDescriptionbooleanchangeFlags(Object key, int newFlags) Change property flags.booleanchangeFlags(Object key, DynamicObject.FlagsFunction flagsUpdateFunction) Change property flags.voidDefine new property or redefine existing property.voiddefine(Object key, Object value, int flags, LocationFactory locationFactory) Define new property with a static location or change existing property.booleanDelete property.Get property value.getShape()Get the object's current shape.booleanisEmpty()Returnstrueif this object contains no properties.booleanSet value of existing property.voidsetShapeAndGrow(Shape oldShape, Shape newShape) Set object shape and grow storage if necessary.voidsetShapeAndResize(Shape oldShape, Shape newShape) Set object shape and resize storage if necessary.intsize()Returns the number of properties in this object.booleanEnsure 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:
trueif successful orfalseif 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:
trueif successful orfalseif property not found
-
changeFlags
Change property flags.- Parameters:
key- property identifierflagsUpdateFunction- function updating old flags to new flags- Returns:
trueif successful orfalseif property not found
-
delete
Delete property.- Parameters:
key- property identifier- Returns:
trueif successful orfalseif property not found
-
size
int size()Returns the number of properties in this object. -
isEmpty
boolean isEmpty()Returnstrueif 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:
trueif shape has changed
-