Class Shape.DerivedBuilder
java.lang.Object
com.oracle.truffle.api.object.Shape.DerivedBuilder
- Enclosing class:
Shape
-
Method Summary
Modifier and TypeMethodDescriptionaddConstantProperty(Object key, Object value, int flags) Adds a property with a constant value to the shape.build()Builds a derived shape from the base shape supplied to the constructor using the configuration of this builder.dynamicType(Object dynamicType) Sets initial dynamic object type identifier.shapeFlags(int flags) Sets initial shape flags (default: 0).
-
Method Details
-
dynamicType
Sets initial dynamic object type identifier. SeeDynamicObjectLibrary.setDynamicType(DynamicObject, Object)for more information.- Parameters:
dynamicType- a non-null object type identifier- Throws:
NullPointerException- if the type isnull- Since:
- 20.2.0
- See Also:
-
shapeFlags
Sets initial shape flags (default: 0). Currently limited to 16 bits. SeeDynamicObjectLibrary.setShapeFlags(DynamicObject, int)for more information.- Parameters:
flags- an int value in the range from 0 to 65535 (inclusive)- Throws:
IllegalArgumentException- if the flags value is not in the supported range- Since:
- 20.2.0
- See Also:
-
addConstantProperty
Adds a property with a constant value to the shape. The key must not benulland must not be equal to any previously added property's key.- Parameters:
key- the property's keyvalue- the property's valueflags- the property's flags- Throws:
NullPointerException- if the key isnullIllegalArgumentException- if a property with the key already exists- Since:
- 20.2.0
- See Also:
-
build
Builds a derived shape from the base shape supplied to the constructor using the configuration of this builder.- Returns:
- a new or cached shape
- Since:
- 20.2.0
-