diff --git a/build.gradle.kts b/build.gradle.kts index c86da3cc..b89652f3 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -4,7 +4,7 @@ plugins { allprojects { group = "space.kscience" - version = "0.5.0-dev-9" + version = "0.5.0-dev-10" } subprojects { diff --git a/dataforge-meta/src/commonMain/kotlin/space/kscience/dataforge/meta/Scheme.kt b/dataforge-meta/src/commonMain/kotlin/space/kscience/dataforge/meta/Scheme.kt index 3cf40a76..f7abc1f5 100644 --- a/dataforge-meta/src/commonMain/kotlin/space/kscience/dataforge/meta/Scheme.kt +++ b/dataforge-meta/src/commonMain/kotlin/space/kscience/dataforge/meta/Scheme.kt @@ -10,17 +10,19 @@ import space.kscience.dataforge.values.Value */ public open class Scheme : Described, MetaRepr, MutableMetaProvider, Configurable { - final override var meta: ObservableMutableMeta = MutableMeta() - private set + private var _meta = MutableMeta() - final override var descriptor: MetaDescriptor? = null - internal set + final override val meta: ObservableMutableMeta get() = _meta + + internal var metaDescriptor: MetaDescriptor? = null + + final override val descriptor: MetaDescriptor? get() = metaDescriptor internal fun wrap( items: MutableMeta, preserveDefault: Boolean = false ) { - meta = (if (preserveDefault) items.withDefault(meta.seal()) else items).asObservable() + _meta = (if (preserveDefault) items.withDefault(meta.seal()) else items).asObservable() } /** @@ -69,7 +71,7 @@ public open class SchemeSpec( private val builder: () -> T, ) : Specification, Described { - override fun read(source: Meta): T = empty().also { + override fun read(source: Meta): T = builder().also { it.wrap(MutableMeta().withDefault(source)) } @@ -81,7 +83,7 @@ public open class SchemeSpec( override val descriptor: MetaDescriptor? get() = null override fun empty(): T = builder().also { - it.descriptor = descriptor + it.metaDescriptor = descriptor } @Suppress("OVERRIDE_BY_INLINE")