I use reified generics to capture KClass<>
inline fun <reified T> register(generator: Generator<T>) {
register(T::class, generator)
}
But KType
has some additional properties which are interesting to me like nullability. I would like to write something like this to capture the KType
instead.
inline fun <reified T> register(generator: Generator<T>) {
register(T::ktype, generator) // Doesn't compile
}
...
register<String?>(myGen) // The nullability of String? is captured
Is there someway to capture KType
instead of KClass<>
?
Thanks in advance.