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

Popular posts from this blog

user interface - Python attempting to create a simple gui, getting "AttributeError: 'MainMenu' object has no attribute 'intro_screen'" -

jquery - Common JavaScript snippet to share files on Google Drive, Dropbox, Box.net or SkyDrive -

Android Gson.fromJson error -