use of org.apache.cayenne.exp.parser.ASTDbPath in project cayenne by apache.
the class ExpressionFactory method matchAnyDbExp.
/**
* Creates an expression that matches any of the key-values pairs in
* <code>map</code>.
* <p>
* For each pair <code>pairType</code> operator is used to build a binary
* expression. Key is considered to be a DB_PATH expression. OR is used to
* join pair binary expressions.
*/
public static Expression matchAnyDbExp(Map<String, ?> map, int pairType) {
List<Expression> pairs = new ArrayList<>(map.size());
for (Map.Entry<String, ?> entry : map.entrySet()) {
Expression exp = expressionOfType(pairType);
exp.setOperand(0, new ASTDbPath(entry.getKey()));
exp.setOperand(1, wrapPathOperand(entry.getValue()));
pairs.add(exp);
}
return joinExp(Expression.OR, pairs);
}
Aggregations