* org.geotools.xml.schema.ElementValue[],
* org.xml.sax.Attributes, java.util.Map)
*/
public Object getValue(Element element, ElementValue[] value, Attributes attrs, Map hints)
throws SAXException {
FilterFactory2 factory = FilterSchema.filterFactory(hints);
try {
Expression expr1 = (Expression) value[0].getValue();
Expression expr2 = (Expression) value[1].getValue();
short type = findFilterType(element.getName());
switch (type) {
case FilterType.COMPARE_EQUALS:
return factory.equals(expr1, expr2);
case FilterType.COMPARE_GREATER_THAN:
return factory.greater(expr1, expr2);
case FilterType.COMPARE_GREATER_THAN_EQUAL:
return factory.greaterOrEqual(expr1, expr2);
case FilterType.COMPARE_LESS_THAN:
return factory.less(expr1, expr2);
case FilterType.COMPARE_LESS_THAN_EQUAL:
return factory.lessOrEqual(expr1, expr2);
case FilterType.COMPARE_NOT_EQUALS:
return factory.notEqual(expr1, expr2);
default:
throw new SAXException("Illegal filter for " + element);
}
} catch (ClassCastException filterRequired) {
throw new SAXException("Illegal filter for " + element, filterRequired);