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 values by 'string value' 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 values by Watch "Enum values by New topic
Author

Enum values by 'string value'

Luc Lieber
Greenhorn

Joined: May 17, 2010
Posts: 14

Before I get flooded with "just use a map" replies, let me just say that I've always wondered if Java supports this type of operation

It's a bit hard for me to explain...but I want to produce these results:



//Loaded in the following array with my parser class



I hope this question isn't too cryptic...but I've been trying everything to no avail.

Thanks
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

I think that you can use the java.lang.Enum#valueOf method to do that.


[My Blog]
All roads lead to JavaRanch
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

After reading your post once again, I may have misunderstood what you want to do. Do yo mean that "enum test" does not exist, and you want to dynamically create it ?
Luc Lieber
Greenhorn

Joined: May 17, 2010
Posts: 14

After banging my head against a wall til now I've kind of lost interest to see if this is possible to do, sorry for wasting the time.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Enum values by 'string value'
 
Similar Threads
Conditional statements and string parsing within Node using org.apache.xpath.XPathAPI
Strange but legal enum code
Enum Naming Convention
Start java enum ordinal at 1 instead of 0
HashMap with enums