Reputation: 2387
I have an enum like this:
object Ops extends Enumeration {
val one = Value(0x01)
val two = Value(0x02)
val three = Value(0x03)
val four = Value(0x04)
}
I want to say
Byte someByte = functionThatReturnsAByte
val op = Ops.valueOf(someByte)
The only method close is withName which only takes a String.
Upvotes: 7
Views: 4974