if (args == null || args.size() == 0 || args.size() > 1)
{
throw new NucleusException(LOCALISER.msg("060016", "contains", "CollectionExpression", 1));
}
CollectionExpression collExpr = (CollectionExpression)expr;
AbstractMemberMetaData mmd = collExpr.getJavaTypeMapping().getMemberMetaData();
SQLExpression elemExpr = (SQLExpression)args.get(0);
if (elemExpr.isParameter())
{
// Element is a parameter so make sure its type is set
if (mmd != null && mmd.getCollection() != null)
{
Class elementCls = stmt.getQueryGenerator().getClassLoaderResolver().classForName(mmd.getCollection().getElementType());
stmt.getQueryGenerator().bindParameter(elemExpr.getParameterName(), elementCls);
}
}
if (collExpr instanceof CollectionLiteral)
{
// Literal collection
CollectionLiteral lit = (CollectionLiteral)collExpr;
Collection coll = (Collection)lit.getValue();
JavaTypeMapping m = exprFactory.getMappingForType(boolean.class, true);
if (coll == null || coll.isEmpty())
{
return exprFactory.newLiteral(stmt, m, true).eq(exprFactory.newLiteral(stmt, m, false));
}
if (collExpr.isParameter())
{
stmt.getQueryGenerator().useParameterExpressionAsLiteral((CollectionLiteral)collExpr);
}
boolean useInExpression = false;