Is there a way to identify that a given object is an Enumeration value?
x.isInstanceOf[Enumeration.$Value]
doesn't seem to work, and from what I understand of path-dependent types, shouldn't.
I'd like to write a function that given any Enumeration value, returns its id. Alternatively, an implicit that converts the Enumeration to Int would also be great.
x.isInstanceOf[Enumeration#Value]
works for me. From the specification, Section 3.2.2 "Type Projection".
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With