throws ReportDataFactoryException
{
ClassLoader classLoader = getClassLoader();
if (classLoader == null)
{
throw new ReportDataFactoryException("No classloader!");
}
try
{
Class c = classLoader.loadClass(className);
if (TableModel.class.isAssignableFrom(c) == false &&
ReportData.class.isAssignableFrom(c) == false)
{
throw new ReportDataFactoryException("The specified class must be either a TableModel or a ReportData implementation.");
}
if (Modifier.isAbstract(c.getModifiers()))
{
throw new ReportDataFactoryException("The specified class cannot be instantiated: it is abstract.");
}
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);
}
throw new ReportDataFactoryException
("There is no constructor in class " + className +
" that accepts " + paramCount + " parameters.");
}