Maybe this <@U0AK89KT6>?: ``` inline fun &lt;reifi...
# codereview
k
Maybe this @jkbbwr?:
Copy code
inline fun <reified T: Any> Reader.readFirst(fieldId: Int): T {
    val field = this.getFirst(fieldId)
    return when(T::class) {
        Byte::class -> field.asByte()
        ByteArray::class -> field.asByteArray()
        Short::class -> field.asShort()
        Int::class -> field.asInt()
        Long::class -> field.asLong()
        Date::class -> field.asDate()
        UUID::class -> field.asUUID()
        String::class -> field.asString()
        else -> throw Exception("Non supported type ${T::class}")
    }
}