Package-level declarations
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
}
}
Content copied to clipboard
Types
Link copied to clipboard
Abstract class for enum wrappers that wrap over primitive enum values. The companion object of the enum wrapper should implement this abstract class.
Link copied to clipboard
annotation class ExperimentalEnumsApi
Denotes APIs that are experimental. Their implementation is likely to be changed, and no backwards compatibility is guaranteed.
Link copied to clipboard
Interface which Enums should implement to indicate that they support the EnumFromValue specification.