* @return The mapping for the new object
*/
protected StatementNewObjectMapping getStatementMappingForNewObjectExpression(NewObjectExpression expr)
{
List argExprs = expr.getConstructorArgExpressions();
StatementNewObjectMapping stmtMap = new StatementNewObjectMapping(expr.getNewClass());
if (argExprs != null)
{
Iterator<SQLExpression> argIter = argExprs.iterator();
int j = 0;
while (argIter.hasNext())
{
SQLExpression argExpr = argIter.next();
if (argExpr instanceof SQLLiteral)
{
stmtMap.addConstructorArgMapping(j, ((SQLLiteral)argExpr).getValue());
}
else if (argExpr instanceof NewObjectExpression)
{
stmtMap.addConstructorArgMapping(j,
getStatementMappingForNewObjectExpression((NewObjectExpression)argExpr));
}
else
{
StatementMappingIndex idx = new StatementMappingIndex(argExpr.getJavaTypeMapping());
int[] cols = stmt.select(argExpr, null);
idx.setColumnPositions(cols);
stmtMap.addConstructorArgMapping(j, idx);
}
j++;
}
}
return stmtMap;