DeclarativeComponentCodec<C extends Component> class abstract Assets and loading

A codec derived from one list of fields: the schema, realization (construct via create, then apply writable fields), and delta serialization (read fields, omit values equal to their defaults) all come from the same declarations.

Inheritance

Constructors

DeclarativeComponentCodec()

Properties

componentType Type
The exact component runtime type this codec serializes, used for O(1) serialization dispatch. Component (the default) means "unknown, fall back to scanning claims".
no setteroverride
fields List<ComponentField<C>>
The declared properties, in display and serialize order. Read once per codec (see resolvedFields); the getter typically builds a fresh list.
no setter
hashCode int
The hash code for this object.
no setterinherited
propertySchema List<ComponentPropertyDef>
The component's editable properties, in display order. Drives the inspector, agent discovery, and default-filling on realize. Empty for codecs that do not declare a schema.
no setteroverride
resolvedFields List<ComponentField<C>>
The memoized fields, so realize/serialize do not rebuild every descriptor and closure per call.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
schema ComponentSchema
The component's full portable schema. The default wraps type and propertySchema; override to add docs, an icon, or former type names.
no setterinherited
type String
The serialized component type name this codec handles (for example directionalLight).
no setterinherited

Methods

boolDefault(String name) bool
The declared default for a ComponentPropertyKind.boolean property.
inherited
claims(Component component) bool
Whether component is an instance this codec serializes.
override
create(PropertyReader props) → C
Constructs the component. Constructor-only configuration reads from props; everything with a set binding is applied after.
defaultOf(String name) PropertyValue?
The declared default for property name, or null when the property has no default (throws when name is undeclared).
inherited
intDefault(String name) int
The declared default for an ComponentPropertyKind.integer property.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
numberDefault(String name) double
The declared default for a ComponentPropertyKind.number (or integer) property name, as a double.
inherited
realize(ComponentSpec spec, RealizeContext context) Component?
Builds a live component from spec, or returns null when it cannot be realized in the given context (for example a mesh with no resource realizer).
override
serialize(Component component, SerializeContext context) ComponentSpec?
Serializes component to a ComponentSpec, or returns null if this codec does not handle that component instance.
override
stringDefault(String name) String
The declared default for a ComponentPropertyKind.string property.
inherited
toString() String
A string representation of this object.
inherited
vec3Default(String name) → Vector3
The declared default for a ComponentPropertyKind.vec3 property (cloned).
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited