orangy
private var codes: Map<Int, HttpStatusCode> = HttpStatusCode::class.companionObject!!.declaredMemberProperties
.filter { it.returnType.javaType == HttpStatusCode::class.java }
.map { it.getter.call(HttpStatusCode) as HttpStatusCode }
.associateBy { it.value }
fun fromCode(value: Int): HttpStatusCode? = codes[value]
That would be a quick hack.