草庐IT

ENUM_TYPE

全部标签

java - 枚举 valueOf IllegalArgumentException : No enum const class

我过去在Java中使用过枚举,但出于某种原因,我现在遇到了一个奇怪的错误。它抛出错误的代码行是:switch(ConfigProperties.valueOf(line[0].toLowerCase()){...}我得到一个java.lang.IllegalArgumentException:Noenumconstclassallautomator.ConfigProperties.language示例行中是一个字符串数组。我现在真的很迷茫,不知道哪里出了问题。 最佳答案 枚举常量区分大小写,因此请确保您的常量确实是小写的。另外,我

java - 为什么我得到 org.codehaus.jackson.map.JsonMappingException : No suitable constructor found for type

有人可以告诉我为什么我会收到org.codehaus.jackson.map.JsonMappingException:Nosuitableconstructorfoundfortypeerror?这是我的电话:try{Stringjsonreturn=restTemplate.getForObject("http://"+mRESTServer.getHost()+":8080/springmvc-rest-secured-test/json/{name}",String.class,vars);LOGGER.debug("returnobject:"+jsonreturn.toSt

hibernate 中的 Javassist 失败 : invalid constant type: 60

我正在创建一个cli工具来管理现有的应用程序。应用程序和测试都构建良好并运行良好,但尽管我在运行jar中存在的cli工具时收到javassist失败:INFO:Bytecodeprovidername:javassist...INFO:HibernateEntityManager3.5.1-FinalExceptioninthread"main"javax.persistence.PersistenceException:UnabletoconfigureEntityManagerFactoryatorg.hibernate.ejb.Ejb3Configuration.configur

Java secondary not public 类的使用会产生错误 "Type is not Visible",即使访问的方法在主类中是公共(public)的

我有一个Main.java文件:publicclassMain{privateEntityDrawerentityDrawer;publicvoidsetEntityDrawer(EntityDrawerentityDrawer){this.entityDrawer=entityDrawer;}publicEntityDrawergetEntityDrawer(){returnentityDrawer;}}classEntityDrawer{privateEmpleadoempleado;publicEmpleadogetEmpleado(){returnempleado;}publi

java - Jersey 序列化/反序列化问题 : abstract types can only be instantiated with additional type information

我正在使用Jersey进行序列化和反序列化。我已经使用Jersey在WebLogic上创建了RESTchannel。我有包含抽象类的结果对象。Jersey使用此类的实现名称添加到结果元数据中:{"order":{"@type":"installationOrder",但是,同样的Jersey,在用于反序列化这些数据时,尖叫着以下内容:Causedby:org.codehaus.jackson.map.JsonMappingException:Cannotconstructinstanceofocl.mobile.service.data.order.DetailedOrder,prob

java - 从 Enum 中的类初始化一个新对象

我有一个名为插件的枚举:publicenumPlugins{ROTATING_LINE(plugin.rotatingline.RotatingLine.class),SNOW_SYSTEM(plugin.snow.SnowSystem.class);privateClassc;privatePlugins(Classc){this.c=c;}publicClassgetClassObject(){returnc;}}我想做的是遍历Plugins中的所有枚举,并从那些使用变量c的枚举中创建新对象,如下所示:for(Pluginsplugins:Plugins.values()){Cla

java - 为什么我会收到错误 "File cannot be resolved to a type"?

这是我的部分代码try{BufferedReaderin=newBufferedReader(newInputStreamReader(System.in));while((line=in.readLine())!="exit"){System.out.println("Entercommand");line=in.readLine();CommandcurrentCommand=newCommand(line);FilecurrentFile=newFile(currentCommand.getLsPath());currentCommand.getLsPath()方法返回一个字符串

java - Play Framework : PersistenceException: The type is not a registered entity? (Ebean)

我正在学习适用于Java的PlayFramework2.0教程,但在尝试保存ebean模型(task.save())时遇到此错误。[PersistenceException:Thetype[classmodels.Task]isnotaregisteredentity?Ifyoudon'texplicitlylisttheentityclassestouseEbeanwillsearchforthemintheclasspath.IftheentityisinaJarchecktheebean.search.jarspropertyinebean.propertiesfileorche

java - 有没有欧洲国家和语言的java Enum?

是否有用于在某处列出欧洲国家和语言的任何java(>5)枚举?如果没有,我可能会从这个列表中写下它们:http://www.nationsonline.org/oneworld/european_languages.htm但如果我能避免这种负担,那就太好了!P.S.:最后,我开始使用geonames.org上的geoNames网络服务。对于我在Groovy中使用此代码段的国家/地区:importorg.geonames.*ToponymSearchCriteriasc=newToponymSearchCriteria()sc.setContinentCode("eu")sc.setFe

java - 注释 "not applicable to type"

多年来我一直是IntelliJ的Eclipse用户,所以我真的发现了这个错误,所有对@Override的注释都显示错误“notapplicabletotype”例如,来自JBossErrai的@PostConstruct注释到处都显示此错误,其中导入完全没有错误。我该如何解决这个问题?更新:例如@PostConstruct//Whenhoveredwiththemousepointer'@PostContruct'isnotapplicabletomethodpublicvoidinit(){}截图:http://snag.gy/q5cW5.jpg 最佳答案