
commonMain.maryk.core.models.SingleValueDataModel.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of core-jvm Show documentation
Show all versions of core-jvm Show documentation
Maryk is a Kotlin Multiplatform library which helps you to store, query and send data in a structured way over multiple platforms. The data store stores any value with a version, so it is possible to request only the changed data or live listen for updates.
The newest version!
package maryk.core.models
import maryk.core.models.serializers.SingleValueDataModelSerializer
import maryk.core.properties.IsPropertyContext
import maryk.core.properties.definitions.wrapper.IsDefinitionWrapper
import maryk.core.values.ObjectValues
typealias SingleTypedValueDataModel = SingleValueDataModel
/**
* DataModels which only define a single value. The serializer will encode/decode this value in a
* more friendly way.
*/
abstract class SingleValueDataModel, CX : IsPropertyContext>(
val singlePropertyDefinitionGetter: () -> IsDefinitionWrapper,
): TypedObjectDataModel() {
/** Creates a Data Object by [values] */
abstract override fun invoke(values: ObjectValues): DO
@Suppress("UNCHECKED_CAST", "LeakingThis")
override val Serializer = object : SingleValueDataModelSerializer(
model = this as DM,
singlePropertyDefinitionGetter = singlePropertyDefinitionGetter,
) {}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy