A field can have 5 different Strings values. Lets say: “APPLE”, “ORANGE”, “PEAR”, “BANANA”, “PEACH”.
What is the best way in Kotlin to define such a variable type?
property. And beware of obfuscators such as ProGuard or R8 - you must instruct them to keep the enum, else their name will get mangled
okarm
08/07/2020, 11:42 AM
You can also have the string as a property of the enum constant, therefore you could let it get obfuscated and instead reference the string property for display purposes, not worrying about keep rules
t
tseisel
08/07/2020, 12:26 PM
@okarm I didn't suspect that ! Does this mean that it is kinda dangerous to use enums names in Room entities, as the name could be mangled differently between builds ?
o
okarm
08/07/2020, 12:49 PM
@tseisel Poorly worded by me - I meant in the context of using