refer:enum与int、String之间的转换
http://www.blogjava.net/wangxinsh55/archive/2012/11/07/390958.html
enum<->int
enum -> int: int i = enumType.value.ordinal();
int -> enum: enumType b= enumType.values()[i];
enum<->String
enum -> String: enumType.name()
String -> enum: enumType.valueOf(name);
时间: 2024-10-26 15:43:59