scala - how can I initialize an enum from an Int or Byte? -
i have enum this:
object ops extends enumeration { val 1 = value(0x01) val 2 = value(0x02) val 3 = value(0x03) val 4 = value(0x04) }
i want say
byte somebyte = functionthatreturnsabyte val op = ops.valueof(somebyte)
the method close withname takes string.
ops(somebyte)
will trick.
Comments
Post a Comment