/** * A convenience shortcut for boolean true expression. * * @since 3.0 */ public static Expression expTrue() { return new ASTTrue(); }
@Override public Expression shallowCopy() { return new ASTTrue(id); }
/** * Creates an expression to match a collection of values against a single * path expression. <h3>Splits</h3> * <p> * Note that "path" argument here can use a split character (a pipe symbol - * '|') instead of dot to indicate that relationship following a path should * be split into a separate set of joins. There can only be one split at * most. Split must always precede a relationship. E.g. * "|exhibits.paintings", "exhibits|paintings", etc. * * @param path * @param values * @since 3.0 */ public static Expression matchAllExp(String path, Collection<?> values) { if (values == null) { throw new NullPointerException("Null values collection"); } if (values.size() == 0) { return new ASTTrue(); } return matchAllExp(path, values.toArray()); }
/** * @since 4.0 * @see ExpressionFactory#notInExp(String, Collection) */ static Expression notInExp(Expression exp, Collection<?> values) { if (values.isEmpty()) { return new ASTTrue(); } if(!(exp instanceof SimpleNode)) { throw new IllegalArgumentException("exp should be instance of SimpleNode"); } return new ASTNotIn((SimpleNode)exp, new ASTList(values)); }
/** * @since 4.0 * @see ExpressionFactory#notInExp(String, Object[]) */ static Expression notInExp(Expression exp, Object... values) { if (values.length == 0) { return new ASTTrue(); } if(!(exp instanceof SimpleNode)) { throw new IllegalArgumentException("exp should be instance of SimpleNode"); } return new ASTNotIn((SimpleNode)exp, new ASTList(values)); }
return new ASTTrue();
/** * A convenience shortcut for building NOT_IN expression. Return ASTTrue for * empty collection. * * @since 3.0 */ public static Expression notInDbExp(String pathSpec, Collection<?> values) { if (values.isEmpty()) { return new ASTTrue(); } return new ASTNotIn(new ASTDbPath(pathSpec), new ASTList(values)); }
/** * A convenience shortcut for building NOT_IN expression. Return ASTTrue for * empty collection. * * @since 3.0 */ public static Expression notInDbExp(String pathSpec, Object... values) { if (values.length == 0) { return new ASTTrue(); } return new ASTNotIn(new ASTDbPath(pathSpec), new ASTList(values)); }
@Override protected Object transformExpression(Transformer transformer) { Object transformed = super.transformExpression(transformer); // transform empty ASTNotIn to ASTTrue if (transformed instanceof ASTNotIn) { ASTNotIn exp = (ASTNotIn) transformed; if (exp.jjtGetNumChildren() == 2) { ASTList list = (ASTList) exp.jjtGetChild(1); Object[] objects = (Object[]) list.evaluate(null); if (objects.length == 0) { transformed = new ASTTrue(); } } } return transformed; }
final public void simpleCondition() throws ParseException { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case TRUE: ASTTrue jjtn001 = new ASTTrue(JJTTRUE); boolean jjtc001 = true; jjtree.openNodeScope(jjtn001);