Controls
Holds all controls associated with a model instance, across three parallel families:
Numeric controls — properties annotated with KSLControl; values are
Doubleand respect declared lower/upper bounds.String controls — properties annotated with KSLStringControl; values are
String, optionally constrained to a declared set of allowed values.JSON controls — properties annotated with KSLJsonControl; values are any
kotlinx.serialization-compatible Kotlin type transported as JSON strings (e.g.List<Double>,Map<String, Int>,@Serializableclasses).
Controls are extracted in a single element-graph walk performed during init, which runs when the caller first calls model.controls(). This guarantees all model elements are fully constructed before any initial value is captured.
Commonly used functions:
Numeric:
controlKeys()— names of the numeric controlscontrol(key)— returns the named ControlIfc or nullasMap()— flatMap<String, Double>of all numeric controlssetControlsFromMap(map)— bulk-set numeric controls from a flat mapcontrolData()— list of ControlData DTOs for data transfer
String:
stringControlKeys()— names of the string controlsstringControl(key)— returns the named StringControlIfc or nullstringControlsAsMap()— flatMap<String, String>of all string controlssetStringControlsFromMap(map)— bulk-set string controls; invalid values are logged and skipped rather than aborting the entire updatestringControlData()— list of StringControlData DTOs for data transfer
JSON:
jsonControlKeys()— names of the JSON controlsjsonControl(key)— returns the named JsonControlIfc or nulljsonControlsAsMap()— flatMap<String, String>of all JSON controls (values are JSON strings)setJsonControlsFromMap(map)— bulk-set JSON controls; invalid JSON is logged and skipped rather than aborting the entire updatejsonControlData()— list of JsonControlData DTOs for data transfer
Batch export / import (all families):
exportAll()— produces a ModelControlsExport snapshot of every controlexportAllAsJson()— pretty-printed JSON string of the full snapshotimportAll(export)— applies a ModelControlsExport; returns ControlImportResultimportAllFromJson(json)— deserializes then delegates toimportAll
Properties
Functions
Returns all numeric controls as a list.
Returns all numeric controls of the given controlType.
Returns the numeric control for controlKey, or null if not found.
Returns a list of ControlData DTOs for all numeric controls.
Returns the numeric control data as a formatted string.
Returns the set of numeric control key names.
Returns a map from model element type (simple class name) to the list of numeric controls belonging to elements of that type.
Returns a map from model element name to the list of numeric controls belonging to that element.
Returns a JSON string representation of the flat numeric controls map.
Returns the set of ControlType values present in the extracted controls.
Produces a ModelControlsExport snapshot of every control in this model.
Serializes exportAll to a pretty-printed JSON string.
Returns true if a numeric control with name exists.
Returns true if a JSON control with name exists.
Returns true if a string control with name exists.
Applies export to this model's controls, updating each control whose key is found in the respective map.
Deserializes json into a ModelControlsExport and delegates to importAll.
Returns the JSON control for key, or null if not found.
Returns a list of JsonControlData DTOs for all JSON controls.
Returns the JSON control data as a formatted string.
Returns the set of JSON control key names.
Returns all JSON controls as a list.
Returns a flat Map<String, String> of all JSON controls. The key is JsonControlIfc.keyName and the value is the current JSON string.
Prints all numeric controls as keyName = value pairs.
Sets numeric controls from a JSON string representing a Map<String, Double>.
Sets numeric controls from a flat map of key → value pairs. Keys not found in the extracted controls are logged as warnings and skipped.
Sets JSON controls from a flat map of key → JSON-string pairs.
Sets string controls from a flat map of key → value pairs.
Returns the string control for key, or null if not found.
Returns a list of StringControlData DTOs for all string controls.
Returns the string control data as a formatted string.
Returns the set of string control key names.
Returns all string controls as a list.
Returns a flat Map<String, String> of all string controls. The key is StringControlIfc.keyName and the value is the current control value.
Builds a ReportNode.Document for this Controls instance.