It would be convenient to have a safe conversion for enumerations:
inline fun <reified T : Enum> valueOfOrNull(type: String): T? {
return try {
java.lang.Enum.valueOf(T::class.java, type)
} catch (e: IllegalArgumentException) {
null
}
}
It would be convenient to have a safe conversion for enumerations:
inline fun <reified T : Enum> valueOfOrNull(type: String): T? {
return try {
java.lang.Enum.valueOf(T::class.java, type)
} catch (e: IllegalArgumentException) {
null
}
}