EnumUtils.getEnum 异常 The Class must be a subclass of Enum
2018-01-20 11:05
281 查看
错误原因
使用了org.apache.commons.lang.enums下的
EnumUtils工具类,该类中的
getEnum(Class enumClass, String name)方法中enumClass要求传入
org.apache.commons.lang.enums.Enum的子类:
在普通项目中,一般会使用简单的枚举类型,因此出错。
解决方案
使用org.apache.commons.lang3包下的
EnumUtils工具类,maven依赖:
<dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-lang3</artifactId> <version>3.4</version> </dependency>
相关文章推荐
- java-No exception of type ConfigurationException can be thrown; an exception type must be a subclass of Throwable
- The content of element type "class" must match "(meta*,subselect?,cache?,synchronize*,comment?,tupli
- No exception of type JmsException can be thrown; an exception type must be a subclass of Throwable
- No exception of type HibernateException can be thrown; an exception type must be a subclass of Thro
- "org.xml.sax.SAXParseException: The content of element type "class" must match" 异常解决
- java-No exception of type ConfigurationException can be thrown; an exception type must be a subclass
- The content of element type "class" must match "(meta*,subselect?,cache?,synchronize*,comment?,tupli
- AndroidStudio3.0 注解报错Annotation processors must be explicitly declared now. The following dependencies on the compile classpath are found to contain annotation processor.
- android The public type classname must be defined in its own file 报错
- View.setTag(key,object)异常 The key must be an application-specific resource id.
- TypeError: view must be a callable or a list/tuple in the case of include()
- Error parsing XML: prefix must not be bound to one of the reserved namespace names
- Mybatis 异常: The content of elements must consist of well-formed character data or markup
- Android开发 -- setTag的妙用和The key must be an application-specific resource id 异常
- 异常:Error: Aesthetics must either be length one, or the same length as the dataProblems:AData
- GIT版本管理异常总结001---copssh安装后登录异常The authenticity of host '127.0.0.1 (127.0.0.1)' can't be established.
- hibernate:newclass.hbm.xml文件错误(the content of element type "class" must match "(meta*,column*,type?generator?...)
- The content of element type "session-factory" must match "(property*,mapping*,(class-cache| collect
- Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP
- The DefaultButton of must be the ID of a control of type IButtonControl