/** * Create a {@code all col} expression * * @param col collection expression * @return all col */ @SuppressWarnings("unchecked") public static <T> Expression<T> all(CollectionExpression<?, ? super T> col) { return new OperationImpl<T>((Class<T>) col.getParameter(0), Ops.QuantOps.ALL, ImmutableList.<Expression<?>>of(col)); }
/** * Create a {@code any col} expression * * @param col collection expression * @return any col */ @SuppressWarnings("unchecked") public static <T> Expression<T> any(CollectionExpression<?, ? super T> col) { return new OperationImpl<T>((Class<T>) col.getParameter(0), Ops.QuantOps.ANY, ImmutableList.<Expression<?>>of(col)); }
@SuppressWarnings("rawtypes") private static <T> Path<T> replaceParent(Path<T> path, Path<?> parent) { PathMetadata metadata = new PathMetadata(parent, path.getMetadata().getElement(), path.getMetadata().getPathType()); if (path instanceof CollectionExpression) { CollectionExpression<?,?> col = (CollectionExpression<?,?>) path; return (Path<T>) Expressions.listPath(col.getParameter(0), SimplePath.class, metadata); } else { return ExpressionUtils.path(path.getType(), metadata); } }
/** * Create a min(col) expression * * @param left collection * @return min(col) */ public static <A extends Comparable<? super A>> ComparableExpression<A> min(CollectionExpression<?,A> left) { return Expressions.comparableOperation((Class) left.getParameter(0), Ops.QuantOps.MIN_IN_COL, (Expression<?>) left); }
/** * Create a {@code all col} expression * * @param col collection expression * @return all col */ @SuppressWarnings("unchecked") public static <T> Expression<T> all(CollectionExpression<?, ? super T> col) { return new OperationImpl<T>((Class<T>) col.getParameter(0), Ops.QuantOps.ALL, ImmutableList.<Expression<?>>of(col)); }
/** * Create a max(col) expression * * @param left collection * @return max(col) */ public static <A extends Comparable<? super A>> ComparableExpression<A> max(CollectionExpression<?,A> left) { return Expressions.comparableOperation((Class) left.getParameter(0), Ops.QuantOps.MAX_IN_COL, (Expression<?>) left); }
@SuppressWarnings("unchecked") static <T> Class<T> getElementTypeOrType(Path<T> path) { if (path instanceof CollectionExpression) { return ((CollectionExpression) path).getParameter(0); } else { return (Class<T>) path.getType(); } }
/** * Create a avg(col) expression * * @param col collection * @return avg(col) */ public static <A extends Comparable<? super A>> ComparableExpression<A> avg(CollectionExpression<?,A> col) { return Expressions.comparableOperation((Class) col.getParameter(0), Ops.QuantOps.AVG_IN_COL, (Expression<?>) col); }
/** * Create a {@code any col} expression * * @param col collection expression * @return any col */ @SuppressWarnings("unchecked") public static <T> Expression<T> any(CollectionExpression<?, ? super T> col) { return new OperationImpl<T>((Class<T>) col.getParameter(0), Ops.QuantOps.ANY, ImmutableList.<Expression<?>>of(col)); }
@SuppressWarnings("rawtypes") private static <T> Path<T> replaceParent(Path<T> path, Path<?> parent) { PathMetadata metadata = new PathMetadata(parent, path.getMetadata().getElement(), path.getMetadata().getPathType()); if (path instanceof CollectionExpression) { CollectionExpression<?,?> col = (CollectionExpression<?,?>) path; return (Path<T>) Expressions.listPath(col.getParameter(0), SimplePath.class, metadata); } else { return ExpressionUtils.path(path.getType(), metadata); } }
if (Collection.class.isAssignableFrom(op.getArg(0).getType())) { if (op.getArg(0) instanceof CollectionExpression) { Class<?> par = ((CollectionExpression) op.getArg(0)).getParameter(0); treat = !par.equals(op.getArg(1).getType());