Getting java enum by name
This question already has an answer here:
每个Java枚举都有方法valueOf(String name)
,它通过名称返回枚举。
MyEnum foo = MyEnum.valueOf("TOTO");
MyEnum bar = MyEnum.valueOf("ZOZO");
链接地址: http://www.djcxy.com/p/38106.html
上一篇: 如何通过类将字符串值转换为Enum值?
下一篇: 通过名称获取Java枚举