return new IntegerLiteral(stmt,
exprFactory.getMappingForType(int.class, false), val.ordinal(), null);
}
else if (expr instanceof EnumExpression)
{
EnumExpression enumExpr = (EnumExpression)expr;
JavaTypeMapping m = enumExpr.getJavaTypeMapping();
if (m.getJavaTypeForDatastoreMapping(0).equals(ClassNameConstants.JAVA_LANG_STRING))
{
throw new NucleusException("EnumExpression.ordinal is not supported when the enum is stored as a string");
}
else
{
return enumExpr.getDelegate();
}
}
else
{
throw new NucleusException(LOCALISER.msg("060001", "ordinal", expr));