if (staticOperand instanceof BindVariableName) {
BindVariableName bindVariable = (BindVariableName)staticOperand;
String variableName = bindVariable.getVariableName();
literalValue = variables.get(variableName); // may be null
} else {
Literal literal = (Literal)staticOperand;
literalValue = literal.getValue();
}
// Create the correct comparator ...
final TypeFactory<?> typeFactory = types.getTypeFactory(expectedType);
assert typeFactory != null;
final Comparator<Object> comparator = (Comparator<Object>)typeFactory.getComparator();