解决方案 »
- 咨询大家个问题,lucene建立索引时当2个数据表之间有主外键关系时,是把两个两个表的数据合并成一个建索引,还是单独每个表建,谢谢。
- 汉字转换为阿拉伯数字,一百三十四亿一千零二十三万六千六百零九,求转换
- GET乱码以及POST乱码的解决方法
- Struts
- tomcat监控需要用到jmx
- JAVA怎么样自动处理一个文件夹下面所有的文本文件?大虾们请指教
- 使用hibernate做的分页,第一二页取得的数据重复
- 不用hibernate级联保存,还有有办法吗?
- 请问怎么用JB7给放在客户端的home,remote接口打包?
- 寻找凑单算法的最优算法【持续更新】
- 如何在规定时间执行任务....急
- struts1多个文件下载如何实现
2.至于强制转化的过程,我觉得可以。因为excel支持的类型就那么几种。完全可以可以通过if else来判断。虽然扩展性不强。
1.顺序问题,可能我中途有调整过变量名的数量,粗心了把get/set方法顺序弄乱了,今天休息,星期一我去公司验证下。
2.我不想在我处理生成Eecel的方法里去判断,如果那样判断肯定是没问题的,我想把判断的方法抽成一个函数,请问如何实现?
不对啊,Method[] methods = dtoClass.getDeclareMethods();
里面的get方法顺序都是乱的。
Field[] fields = clazz.getDeclaredFields();for(Field field : fields) {
PropertyDescriptor desc = new PropertyDescriptor(field.getName(), clazz);
Method getMethod = desc.getReadMethod();
}
这样顺序就跟你定义的变量是一样的了
是按顺序的,昏啊。。
getMethod.setAccessible(true);
原来是这样的:
getFields()方法:
Returns an array containing <code>Field</code> objects reflecting all
the accessible public fields of the class or interface represented by
this <code>Class</code> object.getDeclaredFields()方法:
Returns an array of <code>Field</code> objects reflecting all the fields
declared by the class or interface represented by this
<code>Class</code> object. This includes public, protected, default
(package) access, and private fields, but excludes inherited fields.问题搞定了,多谢closewbq和lianfeng2478帮助,特别lianfeng2478,多谢了,结帖。