}
});
assertEquals(value, Boolean.FALSE);
// build sql expression
StandardExpressionToSqlExprBuilder builder = new StandardExpressionToSqlExprBuilder();
builder.setMapper(new VariableResolver() {
public Object resolve(Variable variable) {
if ("name".equals(variable.getName())) {
return "AGENT.NAME";
}
if ("age".equals(variable.getName())) {
return "AGENT.AGE";
}
if ("licenseToKill".equals(variable.getName())) {
return "AGENT.KILLER";
}
return null;
}
});
builder.setConverter(new ValueConverter() {
public Object convert(Value value) {
if ("licenseToKill".equals(value.getName())) {
return new BooleanToStringConverter("Y", "N")
.convert(value.getValue());
}
return value.getValue();
}
});
SqlExpression sqlExpr = builder.buildSqlExpression(expr);
String sqlString = sqlExpr.toSqlString();
Object[] values = sqlExpr.getValues();
log.info("SQL string: " + sqlString);
log.info("SQL values: " + Arrays.asList(values));
}