dreamer 更新

来源:互联网 发布:犀牛软件作品 编辑:程序博客网 时间:2024/05/17 12:51

好久没有更新了,最近应用在实际的项目中,发现了一个问题。

在linux环境下,由于路径和window下有所不同,导致了一个致命的错误,所有的类都无法加载。

在org.dreamer.scan.Scanner.java 80行

现在修改为:

for (File file2 : files) {if(file2.isDirectory()){list.addAll(getObjectByPath(file2));}if(file2.isFile()&&file2.getName().endsWith(".class")){if(file2.getName().endsWith(".class")){String path=file2.getPath();String base=this.getClassPathSimple().substring(1);path=path.substring(base.length());String []names=path.split("\\.");if(names.length>1){//window环境下的路径path=names[0].replace("\\", ".");//linux环境下的路径path=path.replace("/", ".");}try{if(path.indexOf(".")==0){path=path.substring(1);}//System.out.println(path);Class cls=Class.forName(path);list.add(cls.newInstance());}catch (Exception e) {e.printStackTrace();}}}

在实际应用中,发现我写的解析对象为JSON功能存在N多BUG,现在准备暂时弃用,暂用阿里巴巴的fastjson-1.1.33.jar来解析。

实际应用的截图:

采用注解配置:

最新版的源码下载地址:

http://pan.baidu.com/s/1GgrFd

1 0