Move scheme descriptors to core
This commit is contained in:
parent
24187722e4
commit
67554a8c98
@ -90,9 +90,8 @@ public class MetaDescriptorBuilder internal constructor() {
|
||||
)
|
||||
}
|
||||
|
||||
public fun MetaDescriptorBuilder.item(name: String, block: MetaDescriptorBuilder.() -> Unit) {
|
||||
public fun MetaDescriptorBuilder.item(name: String, block: MetaDescriptorBuilder.() -> Unit): MetaDescriptorBuilder =
|
||||
item(Name.parse(name), block)
|
||||
}
|
||||
|
||||
public fun MetaDescriptor(block: MetaDescriptorBuilder.() -> Unit): MetaDescriptor =
|
||||
MetaDescriptorBuilder().apply(block).build()
|
||||
|
@ -9,8 +9,7 @@ import kotlin.reflect.typeOf
|
||||
public inline fun <S : Scheme, reified T> MetaDescriptorBuilder.value(
|
||||
property: KProperty1<S, T>,
|
||||
noinline block: MetaDescriptorBuilder.() -> Unit = {},
|
||||
) {
|
||||
when (typeOf<T>()) {
|
||||
): MetaDescriptorBuilder = when (typeOf<T>()) {
|
||||
typeOf<Number>(), typeOf<Int>(), typeOf<Double>(), typeOf<Short>(), typeOf<Long>(), typeOf<Float>() ->
|
||||
value(property.name, ValueType.NUMBER) {
|
||||
block()
|
||||
@ -36,7 +35,6 @@ public inline fun <S : Scheme, reified T> MetaDescriptorBuilder.value(
|
||||
block()
|
||||
}
|
||||
else -> item(property.name, block)
|
||||
}
|
||||
}
|
||||
|
||||
public inline fun <S : Scheme, reified T : Scheme> MetaDescriptorBuilder.scheme(
|
||||
|
Loading…
Reference in New Issue
Block a user