I have my java enum such as: FOO("foo"), BAR("bar") ...
and I have a getValue() method to return the value "foo" and "bar" of the enum and this has to be in Java.
On the other hand, I have to match this in Scala:
result match {
case "foo" =>
I am trying to do:
result match {
case Enum.FOO.getValue() =>
I get this error:
method getValue is not a case class constructor, nor does it have an
unapply/unapplySeq method
I'm not quite sure what is happening here since my getValue() method returns a String so why I can't use it for pattern matching? Thanks
matchis aString. So far so good. What treatment is needed in eachcase? Can't it be a method implementation in the enum itself?case Enum.FOO.getValue =>