File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes Enum class question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Enum class question" Watch "Enum class question" New topic
Author

Enum class question

Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

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.


GenRocket - Experts at Building Test Data
Keith Lynn
Ranch Hand

Joined: Feb 07, 2005
Posts: 2367
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

Joined: Jul 11, 2001
Posts: 15299
    
    6

Thanks.
 
 
subject: Enum class question
 
Similar Threads
Java 5 enum - How to display a different value?
JAXB generated enum with multipul fields?
using enum with JDK1.5
Coin Flipping Program!
Please help me with the logic of the code!