且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

反射过载.为反射可变参数方法填充反射数组

更新时间:2023-11-30 21:28:22

我认为问题出在这一行:

I think the problem is in this line:

Object paramArray = Array.newInstance(sqlParameterArrayClass, 1);

具体来说,您没有告诉我们 sqlParameterArrayClass 是什么,但根据名称我猜测这是数组类型的类.其实需要是数组元素的类;请参阅 newInstance(...) 方法.

Specifically, you don't tell us what sqlParameterArrayClass is, but based on the name I'm guessing that is the class of the array type. In fact, it needs to be the class of the array element; see the javadoc for the newInstance(...) methods.