How would rewrite the following Java code in Kotlin?
@SuppressWarnings({ "unchecked", "rawtypes" })
static Object getEnumValue(String enumClassName, String enumValue) throws ClassNotFoundException {
Class<Enum> enumClz = (Class<Enum>)Class.forName(enumClassName);
return Enum.valueOf(enumClz, enumValue);
}
I've tried several solutions but I'm unable to get the right syntax, especially without using java.lang.Enum
.
Aucun commentaire:
Enregistrer un commentaire