获取为枚举类型集合
import java.util.ArrayList; import java.util.Collection; /* from n o w j a v a . c o m - 时 代 Java*/ import java.util.List; public class Main{ public static final String VALUE_DELIMITER = ","; @SuppressWarnings({ "rawtypes", "unchecked" }) public static final <E extends Enum<E>> List getAsEnumTypeCollection( String valueAsString, Class<E> type) throws Exception { List result = new ArrayList(); String[] valuesArray = null; /* from N o w J a v a . c o m */ if ((valueAsString != null) && (!valueAsString.isEmpty()) && (type != null)) { valuesArray = valueAsString.split(VALUE_DELIMITER); for (int i = 0; i < valuesArray.length; i++) { result.add(StringToTypedValueHelper.getAsEnumType( valuesArray[i], type)); } } return result; } public static final <E extends Enum<E>> Object getAsEnumType( String valueAsString, Class<E> type)