Package io.github.edricchan03.androidx.common.enums
Common enum utilities such as EnumFromValue
:
enum class Example(val value: String) {
One("one"),
Two("two"),
Three("abc");
companion object : EnumFromValue<String, Example>(default = Three) {
override fun fromValueOrNull(value: String) = when (value) {
"one" -> One
"two" -> Two
"abc", "other value" -> Three
else -> null
}
}
See: Description
-
Class Summary Class Description EnumFromValue Abstract class for enum wrappers that wrap over primitive enum values.