throws ReportDataFactoryException
{
final ClassLoader classLoader = getClassLoader();
if (classLoader == null)
{
throw new ReportDataFactoryException("No classloader!"); //$NON-NLS-1$
}
try
{
final Class c = Class.forName(className, false, classLoader);
if (TableModel.class.isAssignableFrom(c) == false)
{
throw new ReportDataFactoryException
("The specified class must be either a TableModel or a ReportData implementation: " + className); //$NON-NLS-1$
}
if (Modifier.isAbstract(c.getModifiers()))
{
throw new ReportDataFactoryException
("The specified class cannot be instantiated: it is abstract:" + className); //$NON-NLS-1$
}
final Constructor[] methods = c.getConstructors();
for (int i = 0; i < methods.length; i++)
{
final Constructor method = methods[i];
if (Modifier.isPublic(method.getModifiers()) == false)
{
continue;
}
if (method.getParameterTypes().length != paramCount)
{
continue;
}
return method;
}
}
catch (ClassNotFoundException e)
{
throw new ReportDataFactoryException("No such Class", e); //$NON-NLS-1$
}
throw new ReportDataFactoryException
("There is no constructor in class " + className + //$NON-NLS-1$
" that accepts " + paramCount + " parameters."); //$NON-NLS-1$ //$NON-NLS-2$
}