public Expression notExp() { Expression exp = ExpressionFactory.expressionOfType(Expression.NOT); exp.setOperand(0, this); return exp; }
public Expression notExp() { Expression exp = ExpressionFactory.expressionOfType(Expression.NOT); exp.setOperand(0, this); return exp; }
public Expression notExp() { Expression exp = ExpressionFactory.expressionOfType(Expression.NOT); exp.setOperand(0, this); return exp; }
public Expression notExp() { Expression exp = ExpressionFactory.expressionOfType(Expression.NOT); exp.setOperand(0, this); return exp; }
private static Expression join(int type, Expression... expressions) { int len = expressions != null ? expressions.length : 0; if (len == 0) { return null; } Expression currentExp = expressions[0]; if (len == 1) { return currentExp; } Expression exp = expressionOfType(type); for (int i = 0; i < len; i++) { exp.setOperand(i, expressions[i]); } return exp; }
/** * Joins all <code>expressions</code> in a single expression. <code>type</code> is * used as an expression type for expressions joining each one of the items on the * list. <code>type</code> must be binary expression type. * <p> * For example, if type is Expression.AND, resulting expression would match all * expressions in the list. If type is Expression.OR, resulting expression would match * any of the expressions. * </p> */ public static Expression joinExp(int type, List expressions) { int len = expressions.size(); if (len == 0) return null; Expression currentExp = (Expression) expressions.get(0); if (len == 1) { return currentExp; } Expression exp = expressionOfType(type); for (int i = 0; i < len; i++) { exp.setOperand(i, expressions.get(i)); } return exp; } }
/** * 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 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); }
/** * 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 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); }
/** * Creates a new expression that joins this object with another expression, using * specified join type. It is very useful for incrementally building chained * expressions, like long AND or OR statements. */ public Expression joinExp(int type, Expression exp) { Expression join = ExpressionFactory.expressionOfType(type); join.setOperand(0, this); join.setOperand(1, exp); join.flattenTree(); return join; }
public Object transform(Object input) { if (!(input instanceof Expression)) { return input; } Expression expression = (Expression) input; if (expression.getType() != Expression.OBJ_PATH) { return input; } // convert obj_path to db_path String converted = toDbPath(createPathIterator((String) expression.getOperand(0))); Expression exp = ExpressionFactory.expressionOfType(Expression.DB_PATH); exp.setOperand(0, converted); return exp; } }
public Object transform(Object input) { if (!(input instanceof Expression)) { return input; } Expression expression = (Expression) input; if (expression.getType() != Expression.DB_PATH) { return input; } String path = (String) expression.getOperand(0); String converted = translatePath(path); Expression transformed = ExpressionFactory .expressionOfType(Expression.DB_PATH); transformed.setOperand(0, converted); return transformed; }
public Object transform(Object input) { if (!(input instanceof Expression)) { return input; } Expression expression = (Expression) input; if (expression.getType() != Expression.OBJ_PATH) { return input; } // convert obj_path to db_path String converted = toDbPath(resolvePathComponents(expression)); Expression exp = ExpressionFactory.expressionOfType(Expression.DB_PATH); exp.setOperand(0, converted); return exp; } }
public Object transform(Object input) { if (!(input instanceof Expression)) { return input; } Expression expression = (Expression) input; if (expression.getType() != Expression.DB_PATH) { return input; } String path = (String) expression.getOperand(0); String converted = translatePath(path); Expression transformed = ExpressionFactory.expressionOfType(Expression.DB_PATH); transformed.setOperand(0, converted); return transformed; }
/** * Creates a new expression that joins this object with other expressions, * using specified join type. It is very useful for incrementally building * chained expressions, like long AND or OR statements. * * @since 4.0 */ public Expression joinExp(int type, Expression exp, Expression... expressions) { Expression join = ExpressionFactory.expressionOfType(type); join.setOperand(0, this); join.setOperand(1, exp); for (int i = 0; i < expressions.length; i++) { Expression expressionInArray = expressions[i]; join.setOperand(2 + i, expressionInArray); } join.flattenTree(); return join; }