Relaxed type restriction on MetaConverter
This commit is contained in:
parent
9d3c7149b7
commit
474597777c
@ -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.
|
- **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
|
- Kotlin 1.5.10
|
||||||
- Build tools 0.10.0
|
- Build tools 0.10.0
|
||||||
|
- Relaxed type restriction on `MetaConverter`. Now nullables are available.
|
||||||
|
|
||||||
### Deprecated
|
### Deprecated
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@ plugins {
|
|||||||
|
|
||||||
allprojects {
|
allprojects {
|
||||||
group = "space.kscience"
|
group = "space.kscience"
|
||||||
version = "0.4.3"
|
version = "0.4.4-dev-1"
|
||||||
}
|
}
|
||||||
|
|
||||||
subprojects {
|
subprojects {
|
||||||
|
@ -6,7 +6,7 @@ import space.kscience.dataforge.values.*
|
|||||||
/**
|
/**
|
||||||
* A converter of generic object to and from [TypedMetaItem]
|
* A converter of generic object to and from [TypedMetaItem]
|
||||||
*/
|
*/
|
||||||
public interface MetaConverter<T : Any> {
|
public interface MetaConverter<T> {
|
||||||
public fun itemToObject(item: MetaItem): T
|
public fun itemToObject(item: MetaItem): T
|
||||||
public fun objectToMetaItem(obj: T): MetaItem
|
public fun objectToMetaItem(obj: T): MetaItem
|
||||||
|
|
||||||
@ -120,5 +120,5 @@ public interface MetaConverter<T : Any> {
|
|||||||
public fun <T : Any> MetaConverter<T>.nullableItemToObject(item: MetaItem?): T? = item?.let { itemToObject(it) }
|
public fun <T : Any> MetaConverter<T>.nullableItemToObject(item: MetaItem?): T? = item?.let { itemToObject(it) }
|
||||||
public fun <T : Any> MetaConverter<T>.nullableObjectToMetaItem(obj: T?): MetaItem? = obj?.let { objectToMetaItem(it) }
|
public fun <T : Any> MetaConverter<T>.nullableObjectToMetaItem(obj: T?): MetaItem? = obj?.let { objectToMetaItem(it) }
|
||||||
|
|
||||||
public fun <T : Any> MetaConverter<T>.metaToObject(meta: Meta): T = itemToObject(MetaItemNode(meta))
|
public fun <T> MetaConverter<T>.metaToObject(meta: Meta): T = itemToObject(MetaItemNode(meta))
|
||||||
public fun <T : Any> MetaConverter<T>.valueToObject(value: Value): T = itemToObject(MetaItemValue(value))
|
public fun <T> MetaConverter<T>.valueToObject(value: Value): T = itemToObject(MetaItemValue(value))
|
||||||
|
Loading…
Reference in New Issue
Block a user