/** * Create a {@code this && any(predicates)} expression * * <p>Returns an intersection of this and the union of the given predicates</p> * * @param predicates union of predicates * @return this && any(predicates) */ public BooleanExpression andAnyOf(Predicate... predicates) { return and(ExpressionUtils.anyOf(predicates)); }
/** * Create the intersection of this and the union of the given args * {@code (this && (arg1 || arg2 ... || argN))} * * @param args union of predicates * @return the current object */ public BooleanBuilder andAnyOf(Predicate... args) { if (args.length > 0) { and(ExpressionUtils.anyOf(args)); } return this; }
/** * or * * @param predicate 条件 * @return 最终条件 */ @Nullable default Predicate or(@Nonnull Predicate... predicate) { return ExpressionUtils.anyOf(predicate); }
/** * Create a {@code this && any(predicates)} expression * * <p>Returns an intersection of this and the union of the given predicates</p> * * @param predicates union of predicates * @return this && any(predicates) */ public BooleanExpression andAnyOf(Predicate... predicates) { return and(ExpressionUtils.anyOf(predicates)); }
/** * Create the intersection of this and the union of the given args * {@code (this && (arg1 || arg2 ... || argN))} * * @param args union of predicates * @return the current object */ public BooleanBuilder andAnyOf(Predicate... args) { if (args.length > 0) { and(ExpressionUtils.anyOf(args)); } return this; }
@Override public PredicateExpression visit(OrFilter filter, QueryDslResolutionContext context) { return PredicateExpression.create(ExpressionUtils.anyOf(resolveFilterList(filter.getComposition(), context))); }
@Test public void or_in() { StringPath path = Expressions.stringPath("str"); Expression<?> expr = ExpressionUtils.anyOf( ExpressionUtils.in(path, Arrays.asList("1", "2", "3")), ExpressionUtils.in(path, Arrays.asList("4", "5", "6"))); SQLSerializer serializer = new SQLSerializer(Configuration.DEFAULT); serializer.handle(expr); assertEquals(Arrays.asList(path, path, path, path, path, path), serializer.getConstantPaths()); assertEquals(6, serializer.getConstants().size()); }