final int methodSeparatorIdx = query.indexOf('#');
if ((methodSeparatorIdx + 1) >= query.length())
{
// If we have a method separator, then it cant be at the end of the text.
throw new ReportDataFactoryException("Malformed query: " + query);
}
if (methodSeparatorIdx == -1)
{
// we have no method. So this query must be a reference to a tablemodel
// instance.
final String[] parameterNames;
final int parameterStartIdx = query.indexOf('(');
final String constructorName;
if (parameterStartIdx == -1)
{
parameterNames = new String[0];
constructorName = query;
}
else
{
parameterNames = createParameterList(query, parameterStartIdx);
constructorName = query.substring(0, parameterStartIdx);
}
try
{
Constructor c = findDirectConstructor(constructorName, parameterNames.length);
Object[] params = new Object[parameterNames.length];
for (int i = 0; i < parameterNames.length; i++)
{
final String name = parameterNames[i];
params[i] = DataSetUtility.getByName(parameters, name);
}
final Object o = c.newInstance(params);
if (o instanceof TableModel)
{
return new TableReportData ((TableModel) o);
}
return (ReportData) o;
}
catch (Exception e)
{
throw new ReportDataFactoryException
("Unable to instantiate class for non static call.", e);
}
}
return createComplexTableModel