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 interfaceDynamicObject.FlagsFunction
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleanchangeFlags(java.lang.Object key, int newFlags)Change property flags.booleanchangeFlags(java.lang.Object key, DynamicObject.FlagsFunction flagsUpdateFunction)Change property flags.voiddefine(java.lang.Object key, java.lang.Object value, int flags)Define new property or redefine existing property.voiddefine(java.lang.Object key, java.lang.Object value, int flags, LocationFactory locationFactory)Define new property with a static location or change existing property.booleandelete(java.lang.Object key)Delete property.java.lang.Objectget(java.lang.Object key, java.lang.Object defaultValue)Get property value.ShapegetShape()Get the object's current shape.booleanisEmpty()Returnstrueif this object contains no properties.booleanset(java.lang.Object key, java.lang.Object value)Set 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.booleanupdateShape()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:
trueif successful orfalseif 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:
trueif successful orfalseif 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:
trueif successful orfalseif property not found
-
delete
boolean delete(java.lang.Object key)
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
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:
trueif shape has changed
-
-