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)
|
item(Name.parse(name), block)
|
||||||
}
|
|
||||||
|
|
||||||
public fun MetaDescriptor(block: MetaDescriptorBuilder.() -> Unit): MetaDescriptor =
|
public fun MetaDescriptor(block: MetaDescriptorBuilder.() -> Unit): MetaDescriptor =
|
||||||
MetaDescriptorBuilder().apply(block).build()
|
MetaDescriptorBuilder().apply(block).build()
|
||||||
|
@ -9,8 +9,7 @@ import kotlin.reflect.typeOf
|
|||||||
public inline fun <S : Scheme, reified T> MetaDescriptorBuilder.value(
|
public inline fun <S : Scheme, reified T> MetaDescriptorBuilder.value(
|
||||||
property: KProperty1<S, T>,
|
property: KProperty1<S, T>,
|
||||||
noinline block: MetaDescriptorBuilder.() -> Unit = {},
|
noinline block: MetaDescriptorBuilder.() -> Unit = {},
|
||||||
) {
|
): MetaDescriptorBuilder = when (typeOf<T>()) {
|
||||||
when (typeOf<T>()) {
|
|
||||||
typeOf<Number>(), typeOf<Int>(), typeOf<Double>(), typeOf<Short>(), typeOf<Long>(), typeOf<Float>() ->
|
typeOf<Number>(), typeOf<Int>(), typeOf<Double>(), typeOf<Short>(), typeOf<Long>(), typeOf<Float>() ->
|
||||||
value(property.name, ValueType.NUMBER) {
|
value(property.name, ValueType.NUMBER) {
|
||||||
block()
|
block()
|
||||||
@ -36,7 +35,6 @@ public inline fun <S : Scheme, reified T> MetaDescriptorBuilder.value(
|
|||||||
block()
|
block()
|
||||||
}
|
}
|
||||||
else -> item(property.name, block)
|
else -> item(property.name, block)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public inline fun <S : Scheme, reified T : Scheme> MetaDescriptorBuilder.scheme(
|
public inline fun <S : Scheme, reified T : Scheme> MetaDescriptorBuilder.scheme(
|
||||||
|
Loading…
Reference in New Issue
Block a user