public ValuePredicate<?> resolve(
VerifyContext context,
PropertyName name,
PropertyType type,
String expression) throws FormatException {
CompareOperator operator = OPERATORS.get(expression.trim());
if (operator == null) {
return null;
}
switch (type) {
case BYTE:
case SHORT:
case INT:
case LONG:
return new IntegerCompare(operator);
case FLOAT:
case DOUBLE:
return new FloatCompare(operator);
case DECIMAL:
return new DecimalCompare(operator);
case DATE:
case DATETIME:
return new CalendarCompare(operator);
default:
throw new FormatException(MessageFormat.format(
"Property does not support compare(\"{0}\") expression: {1}",
operator.getSymbol(),
name));
}
}