Last active
February 18, 2021 09:39
-
-
Save plnice/bdca61f199bab61b21d16a43fb22f268 to your computer and use it in GitHub Desktop.
EnumWithDefault
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Inherited | |
@Target(CLASS) | |
@Retention(RUNTIME) | |
annotation class EnumWithDefault( | |
val value: String = "UNKNOWN" | |
) | |
@EnumWithDefault // Defaults to UNKNOWN | |
enum class Example { | |
FIRST, SECOND, UNKNOWN | |
} | |
@EnumWithDefault(value = "SECOND") // Defaults to SECOND | |
enum class Example2 { | |
FIRST, SECOND, THIRD | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment