Skip to content

Commit f79dead

Browse files
committed
release(common-enums): v0.0.1
1 parent 5e7f557 commit f79dead

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Common Enums releases
2+
3+
Common code for enums. An example usage is as follows:
4+
5+
```kt
6+
enum class Example(val value: String) {
7+
One("one"),
8+
Two("two"),
9+
Three("abc");
10+
11+
companion object : EnumFromValue<String, Example>(default = Three) {
12+
override fun fromValueOrNull(value: String) = when (value) {
13+
"one" -> One
14+
"two" -> Two
15+
"abc", "other value" -> Three
16+
else -> null
17+
}
18+
}
19+
```
20+
21+
See the [Module docs](./Module.md) for more information on how to include this artifact in your build script, and the [generated Dokka documentation](https://edricchan03.github.io/androidx-ktx-extras/androidx/common/common-enums/index.html) for API usage.
22+
23+
---
24+
25+
## 0.0.1 (29 Jun 2023)
26+
27+
This version adds an abstract [`EnumFromValue`](https://edricchan03.github.io/androidx-ktx-extras/androidx/common/common-enums/io.github.edricchan03.androidx.common.enums/-enum-from-value/index.html) class that all enums' companion object with an internal representation should inherit.
28+
29+
* Initial release

0 commit comments

Comments
 (0)