private Object nextValue(String name) { if (seen == null) { seen = new HashMap<>(); } Object p; if (seen.containsKey(name)) { p = seen.get(name); } else { if (i >= parameters.length) { throw new ExpressionException("Too few parameters to bind expression: " + parameters.length); } p = parameters[i++]; seen.put(name, p); } // wrap lists (for now); also support null parameters // TODO: andrus 8/14/2007 - shouldn't we also wrap non-null // object values in ASTScalars? return (p != null) ? ExpressionFactory.wrapPathOperand(p) : new ASTScalar(null); }
/** * Creates an expression that matches all 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. AND is used to * join pair binary expressions. */ public static Expression matchAllDbExp(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.AND, pairs); }
public Object transform(Object object) { if (!(object instanceof ExpressionParameter)) { return object; } String name = ((ExpressionParameter) object).getName(); if (!parameters.containsKey(name)) { if (pruneMissing) { return PRUNED_NODE; } else { throw new ExpressionException("Missing required parameter: $" + name); } } else { Object value = parameters.get(name); // wrap lists (for now); also support null parameters return (value != null) ? ExpressionFactory.wrapPathOperand(value) : null; } } };
/** * 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); }
/** * Creates an expression that matches any of the key-values pairs in the * <code>map</code>. * <p> * For each pair <code>pairType</code> operator is used to build a binary * expression. Key is considered to be a OBJ_PATH expression. OR is used to * join pair binary expressions. */ public static Expression matchAnyExp(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 ASTObjPath(entry.getKey())); exp.setOperand(1, wrapPathOperand(entry.getValue())); pairs.add(exp); } return joinExp(Expression.OR, pairs); }
/** * Creates an expression that matches all 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 OBJ_PATH expression. AND is used to * join pair binary expressions. */ public static Expression matchAllExp(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 ASTObjPath(entry.getKey())); exp.setOperand(1, wrapPathOperand(entry.getValue())); pairs.add(exp); } return joinExp(Expression.AND, pairs); }
/** * 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. Therefore all keys must * be java.lang.String objects, or ClassCastException is thrown. OR is used to join * pair binary expressions. */ public static Expression matchAnyDbExp(Map map, int pairType) { List pairs = new ArrayList(); Iterator it = map.entrySet().iterator(); while (it.hasNext()) { Map.Entry entry = (Map.Entry) it.next(); 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); }
/** * Creates an expression that matches all 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. Therefore all keys must * be java.lang.String objects, or ClassCastException is thrown. AND is used to join * pair binary expressions. */ public static Expression matchAllDbExp(Map map, int pairType) { List pairs = new ArrayList(); Iterator it = map.entrySet().iterator(); while (it.hasNext()) { Map.Entry entry = (Map.Entry) it.next(); Expression exp = expressionOfType(pairType); exp.setOperand(0, new ASTDbPath(entry.getKey())); exp.setOperand(1, wrapPathOperand(entry.getValue())); pairs.add(exp); } return joinExp(Expression.AND, pairs); }
/** * Creates an expression that matches all 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 OBJ_PATH expression. Therefore all keys must * be java.lang.String objects, or ClassCastException is thrown. AND is used to join * pair binary expressions. */ public static Expression matchAllExp(Map map, int pairType) { List pairs = new ArrayList(); Iterator it = map.entrySet().iterator(); while (it.hasNext()) { Map.Entry entry = (Map.Entry) it.next(); Expression exp = expressionOfType(pairType); exp.setOperand(0, new ASTObjPath(entry.getKey())); exp.setOperand(1, wrapPathOperand(entry.getValue())); pairs.add(exp); } return joinExp(Expression.AND, pairs); }
/** * Creates an expression that matches any of the key-values pairs in the * <code>map</code>. * <p> * For each pair <code>pairType</code> operator is used to build a binary * expression. Key is considered to be a OBJ_PATH expression. Therefore all keys must * be java.lang.String objects, or ClassCastException is thrown. OR is used to join * pair binary expressions. */ public static Expression matchAnyExp(Map map, int pairType) { List pairs = new ArrayList(); Iterator it = map.entrySet().iterator(); while (it.hasNext()) { Map.Entry entry = (Map.Entry) it.next(); Expression exp = expressionOfType(pairType); exp.setOperand(0, new ASTObjPath(entry.getKey())); exp.setOperand(1, wrapPathOperand(entry.getValue())); pairs.add(exp); } return joinExp(Expression.OR, pairs); }
return (value != null) ? ExpressionFactory.wrapPathOperand(value) : new ASTScalar(null);