如何从字符串值中获取ENUM
这个问题在这里已经有了答案:
public enum Signal{
...
public static Signal byValue(String value) {
Singal[] signales = Signal.getEnumConstants();
for (Signal s:signals) {
if (s.getValue().equals(value) {
return s;
}
}
}
}
链接地址: http://www.djcxy.com/p/38097.html
上一篇: how to get the ENUM from the string value
下一篇: Take string and compare to multiple enum types all at once