NodeMetaData

interface NodeMetaData(source)

Marker interface that every node's per-type metadata payload must implement.

Beyond surfacing an error string, the interface declares three extension points that let cross-cutting helpers (error propagation, display naming, digital-signal detection) work uniformly over any concrete subtype without an exhaustive when dispatch:

  • withErrorabstract: every implementing data class must supply a copy(error = error) override. Making it abstract ensures a compile error rather than a silent no-op when a new subtype is introduced.

  • displayName — default "": concrete types that carry a human-readable name field override this; callers fall back to the node's KrillApp type string when the result is empty.

  • isDigital — default false: overridden to true for node types whose values are inherently boolean (Pin, LogicGate, TaskList) and to dataType == DIGITAL for DataPoint.

The implementation classes are @Serializable data classes registered in the consuming module's Serializer.kt polymorphic module; missing such a registration is a runtime crash, not a compile error, so when adding a new subtype always update the serializer module alongside it.

Inheritors

Properties

Link copied to clipboard
abstract val error: String

Last known error message for this node, or empty string when healthy.

Functions

Link copied to clipboard
open fun displayName(): String

Human-readable display name for this node, or empty string when the concrete type has no dedicated name field.

Link copied to clipboard
open fun isDigital(): Boolean

true when this node's value is inherently boolean / digital.

Link copied to clipboard
abstract fun withError(error: String): NodeMetaData

Returns a copy of this metadata with error replaced by the given string.