JsonControlIfc

Represents a JSON-valued simulation control extracted from a property annotated with KSLJsonControl.

The interface is parallel to StringControlIfc and ControlIfc but carries its value as a JSON string rather than a String or Double. The underlying property may be any Kotlin type supported by kotlinx.serialization (e.g. List<Double>, Map<String, Int>, a @Serializable data class).

Setting value with a string that cannot be deserialized into the property's declared Kotlin type throws a ControlUpdateException. The underlying property is not modified when the exception is thrown.

The initialJsonValue is captured once at extraction time from the property's value at that moment. It is not automatically restored on error — callers may read it and assign it back if a revert is desired.

Properties

Link copied to clipboard
abstract val comment: String

Optional comment supplied in the KSLJsonControl annotation.

Link copied to clipboard
abstract val elementId: Int

Identifier of the model element that owns this control.

Link copied to clipboard
abstract val elementName: String

Name of the model element that owns this control.

Link copied to clipboard

Ancestor names from the model root down to (but not including) the model element holding this control, also exclusive of the Model itself. Empty when the control's element is a direct child of the Model.

Link copied to clipboard
abstract val elementType: String

Simple class name of the model element that owns this control.

Link copied to clipboard
abstract val initialJsonValue: String

The property value serialized as JSON at extraction time. Provides a safe fallback if the caller needs to revert after a failed or unwanted update.

Link copied to clipboard
abstract val keyName: String

Unique access key of the form "${elementName}.${propertyName}".

Link copied to clipboard
abstract val modelName: String

Name of the model that contains the owning element.

Link copied to clipboard
open val parentElementId: Int?

Identifier of the parent model element, or null.

Link copied to clipboard

Name of the parent of the model element holding this control, or null when that element is a direct child of the Model. See ControlIfc.parentElementName for the same convention applied to numeric controls.

Link copied to clipboard

Simple class name of the parent model element, or null.

Link copied to clipboard
abstract val propertyName: String

Name of the annotated property.

Link copied to clipboard
abstract val typeHint: String

Human-readable description of the expected Kotlin type, e.g. "kotlin.collections.List<kotlin.Double>". Provided by KSLJsonControl.expectedTypeHint or inferred from the property's KType at extraction time when the annotation field is blank.

Link copied to clipboard
abstract var value: String

Current value of the underlying property serialized as a JSON string. Setting this property deserializes value into the property's declared Kotlin type before delegating to the property setter via reflection.