Java: Parsing a string into an enum?

Discussion in 'Mac Programming' started by iShater, Aug 20, 2009.

  1. iShater macrumors 604

    iShater

    Joined:
    Aug 13, 2002
    Location:
    Chicagoland
    #1
    Java 5.0:

    I have a properties file that has field types defined:
    Code:
    field_types=CHAR,NUM,CHAR
    I am parsing that field to convert the strings to the corresponding enum for the following enum definition:
    Code:
    enum Field_Type
    {
         CHAR, 
         NUM
    }
    Is there a way to do this? :confused:

    Something similar to Integer.parseInt() and others?
     
  2. iShater thread starter macrumors 604

    iShater

    Joined:
    Aug 13, 2002
    Location:
    Chicagoland
    #2
    I think I found it. :p :eek:

     

Share This Page