DocumentCriterion criterion = null;
String fieldName = null;
switch (tree.getType()) {
case MqlParser.DOCUMENT_FUNCTION_CRITERION:
String functionName = child(tree, 0).getChild(0).getText().trim().toLowerCase();
Criterion c = createCriterion(tree, ctx);
if (!DocumentCriterion.class.isInstance(c)) {
throw new MqlException(
"Document function '"+functionName+"' returned a Criterion other than a DocumentCriterion");
}
criterion = DocumentCriterion.class.cast(c);