enum.valueOf(String name) missing from Javadoc 1.5 and 1.6

♀尐吖头ヾ 提交于 2019-12-02 20:29:02

There is no method Enum.valueOf(String) However, every enum has a values() and valueOf(String) method generated by the compiler and these are documented. They are static methods and thus cannot be overridden or defined in a super class or interface.

Enum e = Enum.valueOf(""); // this doesn't compile

http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Thread.State.html#values%28%29

http://docs.oracle.com/javase/6/docs/api/java/lang/Thread.State.html#values%28%29

Its the same in Java 5.0, 6 or 7.

For Java 5.0 http://docs.oracle.com/javase/specs/jls/se5.0/html/classes.html#8.9 (search for values) For Java 7 http://docs.oracle.com/javase/specs/jls/se7/html/jls-8.html#jls-8.9.2 provided by @kapep

Under the hood, enum.valueOf(String name) is actually calling Enum.valueOf(Class<T> enumType, String name)

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!