T
- the default or the
user-defined factory interface to
allocate static objectspublic abstract class StaticShape<T> extends Object
StaticShape.newBuilder(TruffleLanguage)
returns a StaticShape.Builder
object
that can be used to register static properties and to generate a new static shape by
calling one of its build methods.
StaticShape.getFactory()
returns an implementation of the default or the user-defined factory
interface that must be used to allocate static objects with the current shape.
StaticProperty
instances registered to the builder that generated that shape or one of
its parent shapes. Note that static shapes do
not store the list of static properties associated to them. It is up
to the user to store this information when required, for example in a class that contains
references to the static shape and the list of static properties.
StaticShape cannot be subclassed by custom implementations and, when required, it allows static properties to check that the receiver object matches the expected shape.
StaticShape.newBuilder(TruffleLanguage)
,
StaticShape.Builder
,
StaticProperty
,
DefaultStaticProperty
,
DefaultStaticObjectFactory
Modifier and Type | Class and Description |
---|---|
static class |
StaticShape.Builder
Builder class to construct
StaticShape instances. |
Modifier and Type | Method and Description |
---|---|
T |
getFactory()
Returns an instance of the default or the
user-defined factory interface that must
be used to allocate static objects with the current shape.
|
static StaticShape.Builder |
newBuilder(TruffleLanguage<?> language)
Creates a new static shape builder.
|
public static StaticShape.Builder newBuilder(TruffleLanguage<?> language)
StaticProperty
or use DefaultStaticProperty
, a trivial default
implementation. In both cases, static properties must be registered to a static shape builder
using StaticShape.Builder.property(StaticProperty, Class, boolean)
. Then, after
allocating a StaticShape
instance with one of the StaticShape.Builder.build()
methods and allocating a static object using the factory class provided by
StaticShape.getFactory()
, users can call the accessor methods defined in
StaticProperty
to get and set property values stored in a static object instance.language
- an instance of the TruffleLanguage
that uses the Static Object ModelNullPointerException
- if language is nullStaticShape
,
StaticProperty
,
DefaultStaticProperty
,
DefaultStaticObjectFactory
public final T getFactory()
StaticShape.Builder.build()
,
StaticShape.Builder.build(StaticShape)
,
StaticShape.Builder.build(Class, Class)