com.threerings.antidote
Class EnumHelper

java.lang.Object
  extended by com.threerings.antidote.EnumHelper

public class EnumHelper
extends Object

A static helper utility for dealing with enums.


Field Summary
static Locale LOCALE
          The Locale all strings representing enums are assumed to be in.
 
Constructor Summary
EnumHelper()
           
 
Method Summary
static
<T extends Enum<T>>
T
parseEnum(String enumString, Class<T> enumClass)
          Attempts to find the corresponding enum field from the given string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOCALE

public static final Locale LOCALE
The Locale all strings representing enums are assumed to be in.

Constructor Detail

EnumHelper

public EnumHelper()
Method Detail

parseEnum

public static <T extends Enum<T>> T parseEnum(String enumString,
                                              Class<T> enumClass)
Attempts to find the corresponding enum field from the given string. Case will be ignored. Any "-" in the enumString will be turned into a "_" when mapping to the enum constant. Returns the enum field if found, null otherwise.



Copyright © 2007-2008 Three Rings Design, Inc. All Rights Reserved. Released under a BSD license.