ModelReference

@Serializable
sealed class ModelReference(source)

Serialisable pointer to a model source.

ModelReference stores only string data; it contains no live object references and is safe to persist and transport. Resolving a reference to a live ksl.simulation.Model is done at configuration-application time by RunConfiguration.buildModel.

Four variants:

Serialised form

The sealed hierarchy uses the standard kotlinx-serialization class discriminator. The @SerialName annotations on each subclass produce short, human-readable type tags in both JSON and TOML:

[modelReference]
type = "byProviderId"
providerId = "MM1"
"modelReference": { "type": "byProviderId", "providerId": "MM1" }

Inheritors

Constructors

Link copied to clipboard
protected constructor()

Types

Link copied to clipboard
@Serializable
@SerialName(value = "byBundleAndModelId")
data class ByBundleAndModelId(val bundleId: String, val modelId: String) : ModelReference

References a model unambiguously by the pair of its enclosing bundle and the model identifier within that bundle. Use when a document references multiple bundles and a scenario must select exactly one of them (the byProviderId variant relies on flat-modelId lookup which is ambiguous in a multi-bundle document).

Link copied to clipboard
@Serializable
@SerialName(value = "byJar")
data class ByJar(val jarPath: String, val builderClassName: String? = null) : ModelReference

References a model whose ksl.simulation.ModelBuilderIfc is loaded from a JAR file via ksl.utilities.io.JARModelBuilder.

Link copied to clipboard
@Serializable
@SerialName(value = "byProviderId")
data class ByProviderId(val providerId: String) : ModelReference

References a model registered in a ksl.simulation.ModelProviderIfc by its identifier string. The provider itself must be supplied at run time via RunConfiguration.buildModel.

Link copied to clipboard
@Serializable
@SerialName(value = "embedded")
data class Embedded(val modelName: String) : ModelReference

Marker that the originating application held its model in-process (as Kotlin code, not as a JAR or bundle) and the saved configuration therefore does not contain a portable pointer to it. Written by the Single-app framework; resolved at run time by handing the framework's own ksl.simulation.ModelProviderIfc — keyed on modelName — to the orchestrator.