macmedan
06/29/2017, 7:18 PMenums
. I have defined one that looks like this enum class ChartType(val value: String?) {
Text("Text"),
MAP("Map"),
COLUMN("Column Style 1"),
and want to use this enum in a function like this: fun getType():ChartType {
var type = ChartType(value = currentData?.visualizationName)
}
But obviously have something wrong (Enums cannot be Instantiated). So my question is how do I do this properly? Do I have to make a function
with a giant switch statement
that takes a String
and returns the ChartType enum
or is there an better way.