• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Enum class question

 
Gregg Bolinger
GenRocket Founder
Ranch Hand
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If I have an enum defined as follows:


Then somewhere in my code, I have a String value of "INPUT_TYPE_COLOR", is there anyway to give an object the correct CharGroupInputType? I know this syntax is wrong, but something like:



Hope that makes sense. Thanks.
 
Keith Lynn
Ranch Hand
Posts: 2409
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is a method available to enums called valueOf that will return the enum constant corresponding to the name of the constant.
[ December 18, 2006: Message edited by: Keith Lynn ]
 
Gregg Bolinger
GenRocket Founder
Ranch Hand
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic