EnumUtil

object EnumUtil

Utility class for enums.

Functions

Link copied to clipboard
fun <E : Enum<E>?> getEnum(clazz: Class<E>?, name: String?): E?

Returns the matching enum instance based on a input string.

Link copied to clipboard
fun <E : Enum<E>?> getEnumWithDefault(clazz: Class<E>?, name: String?, defaultValue: E): E

Returns the matching enum instance based on a input string with a default value in case there is no match.

Link copied to clipboard
fun <E : Enum<E>?> toString(obj: E?): String?

Returns the name or null.