All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.maryk.core.models.BaseObjectDataModel.kt Maven / Gradle / Ivy

Go to download

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

/**
 * Base class for all Object based DataModels.
 * Implements IsObjectDataModel and provides methods to get properties by name or index.
 */
abstract class BaseObjectDataModel : BaseDataModel(), IsObjectDataModel {
    /** Get a method to retrieve property from DataObject by [name] */
    fun getPropertyGetter(name: String): ((DO) -> Any?)? = nameToDefinition[name]?.run { { getPropertyAndSerialize(it, null) } }

    /** Get a method to retrieve property from DataObject by [index] */
    fun getPropertyGetter(index: UInt): ((DO) -> Any?)? = indexToDefinition[index]?.run { { getPropertyAndSerialize(it, null) } }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy