GarouDan
03/10/2019, 7:14 PMprintln(MyClass.myMapKey1)
println(MyClass.myMapKey2)
...
println(MyClass.myMapKeyN)
Maybe somehow a way to eval a code? Or another technique? (I would like to use this with kotlin-dsl.)
My motivation is that I would like to retrieve a map from a properties file (a yaml one), but if possible, I would like to access my keys like if I was using an enum.
Since the nature of this properties could be dynamic and they could change, it’s not a good idea to use a enum or a class with a defined companion object.
We could access this keys as usual myMap["myMapKey1"], ..., myMap["myMapKeyN"] but I would like to avoid typos and use it like an enum, improving the experience with autocompletion.
Can we achieve something like that?