tornadofx / tornadofx / JsonModel

JsonModel

interface JsonModel

Functions

copy open fun copy(target: JsonModel): Unit

Copy all properties from this object to the given target object by converting to JSON and then updating the target.

open fun <T : JsonModel> copy(): T

Duplicate this model object by creating a new object of the same type and copy over all the model properties.

toJSON open fun toJSON(json: JsonBuilder): Unit

Build a JSON representation of the model properties

open fun toJSON(): JsonObject

Build a JSON representation of the model directly to JsonObject

update open fun update(source: JsonModel): Unit

Copy all properties from the given source object to this object by converting to JSON and then updating this object.

updateModel open fun updateModel(json: JsonObject): Unit

Fetch JSON values and update the model properties

Extension Functions

contains fun JsonModel?.contains(text: String?, ignoreCase: Boolean = true): Boolean
getProperty fun <T> Any.getProperty(prop: KMutableProperty1<*, T>): ObjectProperty<T>
observable fun <T : Any> Any.observable(propName: String): ObjectProperty<T>
save fun JsonModel.save(output: OutputStream): <ERROR CLASS>

Save this JsonModel to the given output stream and close it.

fun JsonModel.save(output: Path, vararg options: OpenOption = arrayOf(CREATE, TRUNCATE_EXISTING)): <ERROR CLASS>

Save this JsonModel to the given output path.

Inheritors

JsonModelAuto interface JsonModelAuto : JsonModel

Requires kotlin-reflect on classpath