Java examples for java.lang:String Parse
Convert String As Enum Type
import java.util.ArrayList; import java.util.Collection; import java.util.List; public class Main{ public static final <E extends Enum<E>> Object getAsEnumType( String valueAsString, Class<E> type) throws Exception { Object result = null;//from w w w . j av a2s . co m if ((valueAsString != null) && (!valueAsString.isEmpty()) && (type != null)) { result = Enum.valueOf(type, valueAsString); } return result; } }