}
private static TypeInfo processConstant(ExpressionNode node, InfoForWiring wiring, TypeInfo typeInfo) {
String constant = node.getASTNode().getText();
StorageTypeEnum ourType;
if(node.getType() == NoSqlLexer.DECIMAL || node.getType() == NoSqlLexer.DEC_VAL){
ourType = StorageTypeEnum.DECIMAL;
BigDecimal dec = new BigDecimal(constant);
node.setState(dec, constant);
} else if(node.getType() == NoSqlLexer.STR_VAL){
String withoutQuotes = constant.substring(1, constant.length()-1);
ourType = StorageTypeEnum.STRING;
node.setState(withoutQuotes, constant);
} else if(node.getType() == NoSqlLexer.INT_VAL){
ourType = StorageTypeEnum.INTEGER;
BigInteger bigInt = new BigInteger(constant);
node.setState(bigInt, constant);
} else if(node.getType() == NoSqlLexer.BOOL_VAL) {
ourType = StorageTypeEnum.BOOLEAN;
boolean boolVal = Boolean.parseBoolean(constant);
node.setState(boolVal, constant);
} else if(node.getType() == NoSqlLexer.NULL) {
ourType = StorageTypeEnum.NULL;
node.setState(null, constant);
}
else
throw new RuntimeException("bug, not supported type(please fix)="+node.getType());
if(typeInfo == null) //no types to check against so return...
return new TypeInfo(ourType);
//we must compare type info so this next stuff is pure validation
if(typeInfo.getColumnInfo() != null) {
validateTypes(wiring, ourType, typeInfo);
} else {
StorageTypeEnum constantType = typeInfo.getConstantType();
if(constantType != ourType)
throw new IllegalArgumentException("Types do not match in namedquery="+wiring.getQuery());
}
return null;
}