try {
if(f == null) {
continue;
}
if (f instanceof PropertyIsLessThan) {
BinaryComparisonOperator cf = (BinaryComparisonOperator) f;
if (cf.getExpression1() instanceof LengthFunction) {
filterLength = cf.getExpression2().evaluate(null, Integer.class) - 1;
}
} else if (f instanceof PropertyIsLessThanOrEqualTo) {
BinaryComparisonOperator cf = (BinaryComparisonOperator) f;
if (cf.getExpression1() instanceof LengthFunction) {
filterLength = cf.getExpression2().evaluate(null, Integer.class);
}
} else if(f instanceof PropertyIsGreaterThan) {
BinaryComparisonOperator cf = (BinaryComparisonOperator) f;
if (cf.getExpression2() instanceof LengthFunction) {
filterLength = cf.getExpression1().evaluate(null, Integer.class) - 1;
}
} else if (f instanceof PropertyIsGreaterThanOrEqualTo) {
BinaryComparisonOperator cf = (BinaryComparisonOperator) f;
if (cf.getExpression2() instanceof LengthFunction) {
filterLength = cf.getExpression1().evaluate(null, Integer.class);
}
}
} catch (NullPointerException e) {
// was not an integer eh? Continue, worst case we'll return ANY_LENGTH
}