修正ExcelField声明在get方法上时提示wrong number of arguments

This commit is contained in:
thinkgem
2025-10-22 10:48:14 +08:00
parent 68d6c09b94
commit 46514450d6

View File

@@ -538,15 +538,13 @@ public class ExcelImport implements Closeable {
ReflectUtils.invokeSetter(e, ef.attrName(), val);
}else{
if (os[1] instanceof Field){
//ReflectUtils.invokeSetter(e, ((Field)os[1]).getName(), val);
((Field)os[1]).set(e, val);
ReflectUtils.invokeSetter(e, ((Field)os[1]).getName(), val);
}else if (os[1] instanceof Method){
//String mthodName = ((Method)os[1]).getName();
//if ("get".equals(mthodName.substring(0, 3))){
// mthodName = "set"+StringUtils.substringAfter(mthodName, "get");
//}
//ReflectUtils.invokeMethod(e, mthodName, new Class[] {valType}, new Object[] {val});
((Method)os[1]).invoke(e, val);
String mthodName = ((Method)os[1]).getName();
if ("get".equals(mthodName.substring(0, 3))){
mthodName = "set"+mthodName.substring(3);
}
ReflectUtils.invokeMethodByAsm(e, mthodName, val);
}
}
}