From 474597777ce322c51dbe375a368792e034abc107 Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Wed, 23 Jun 2021 08:20:22 +0300 Subject: [PATCH] Relaxed type restriction on `MetaConverter` --- CHANGELOG.md | 1 + build.gradle.kts | 2 +- .../dataforge/meta/transformations/MetaConverter.kt | 6 +++--- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7dc1eeaa..df34ec50 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ - **API breaking** Descriptor no has a member property `defaultValue` instead of `defaultItem()` extension. It caches default value state on the first call. It is done because computing default on each call is too expensive. - Kotlin 1.5.10 - Build tools 0.10.0 +- Relaxed type restriction on `MetaConverter`. Now nullables are available. ### Deprecated diff --git a/build.gradle.kts b/build.gradle.kts index c4293377..3c9b82ac 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -4,7 +4,7 @@ plugins { allprojects { group = "space.kscience" - version = "0.4.3" + version = "0.4.4-dev-1" } subprojects { diff --git a/dataforge-meta/src/commonMain/kotlin/space/kscience/dataforge/meta/transformations/MetaConverter.kt b/dataforge-meta/src/commonMain/kotlin/space/kscience/dataforge/meta/transformations/MetaConverter.kt index be7f054c..3945205c 100644 --- a/dataforge-meta/src/commonMain/kotlin/space/kscience/dataforge/meta/transformations/MetaConverter.kt +++ b/dataforge-meta/src/commonMain/kotlin/space/kscience/dataforge/meta/transformations/MetaConverter.kt @@ -6,7 +6,7 @@ import space.kscience.dataforge.values.* /** * A converter of generic object to and from [TypedMetaItem] */ -public interface MetaConverter { +public interface MetaConverter { public fun itemToObject(item: MetaItem): T public fun objectToMetaItem(obj: T): MetaItem @@ -120,5 +120,5 @@ public interface MetaConverter { public fun MetaConverter.nullableItemToObject(item: MetaItem?): T? = item?.let { itemToObject(it) } public fun MetaConverter.nullableObjectToMetaItem(obj: T?): MetaItem? = obj?.let { objectToMetaItem(it) } -public fun MetaConverter.metaToObject(meta: Meta): T = itemToObject(MetaItemNode(meta)) -public fun MetaConverter.valueToObject(value: Value): T = itemToObject(MetaItemValue(value)) +public fun MetaConverter.metaToObject(meta: Meta): T = itemToObject(MetaItemNode(meta)) +public fun MetaConverter.valueToObject(value: Value): T = itemToObject(MetaItemValue(value))