/** * Creates a field criteria for the given node and operator. * * @param node The comparison node to extract selector and argument from. * @param operator The (Morphia) operator to create criteria for. * @return A field criteria for the given comparison. * @throws RSQLValidationException If the node contains more or less than one argument, or a * matching field for the selector cannot be found. */ protected Criteria createCriteria(ComparisonNode node, FilterOperator operator) { MappedFieldPath mfp = resolveFieldPath(node.getSelector()); Object mappedValue = convertToMappedValue(node.getArguments(), mfp, !node.getOperator().isMultiValue()); return new SimpleFieldCriteria(mfp.getFieldPath(), operator, mappedValue); }
public Criteria visit(ComparisonNode node) { return createCriteria(node, OPERATORS_MAP.get(node.getOperator())); }