Is there a way to get `enum`’s `values` from a ins...
# announcements
e
Is there a way to get `enum`’s
values
from a instance variable? e.g.
Copy code
enum class Kind { Single, Double } 
class A(val a: Kind)

A().a /// from here get the type of a and get its enum class, then get enum.values?
r
I'd guess not without using reflection, seems to be a pretty weird thing to do
d
On the JVM you can do
a.declaringClass.enumConstants
,
r
another reflection-free way that could potentially be used is using
enumValues
in an `inline fun`: https://pl.kotl.in/r1UnkBZRX
e
Thanks a lot. Both works as what I trying to do.