Method[] methods = bo.getClass().getMethods();
for (int i = 0; i < methods.length; i++)
{
Class[] paramType = methods[i].getParameterTypes();
//方法名称和参数个数相同
if (methods[i].getName().equals(ro.getMethod()) &&
paramType.length == param.length)
{
for (int j = 0; j < paramType.length; j++)
{
Class ptype = paramType[j];
Object obj = param[j];
if (obj instanceof ptype)
{
}
}
}
}
for (int i = 0; i < methods.length; i++)
{
Class[] paramType = methods[i].getParameterTypes();
//方法名称和参数个数相同
if (methods[i].getName().equals(ro.getMethod()) &&
paramType.length == param.length)
{
for (int j = 0; j < paramType.length; j++)
{
Class ptype = paramType[j];
Object obj = param[j];
if (obj instanceof ptype)
{
}
}
}
}
应该用ptype.isinstance(obj)这个函数来判断。它的效果和instance得到的是一样的