@Override public Object evaluate(Object... args) { final Class sourceType = ((EntityPathBase) sources.get(0)).getType(); if (projection instanceof EntityPathBase) return getArgByType(projection.getType(), args); if (projection instanceof SimpleExpression || projection instanceof PathImpl) return getValue( (Path) projection, getArgByType(((Path) projection).getRoot().getType(), args)); if (projection.getType().equals(Object[].class)) return complexProjection(args); return getArgByType(projection.getType(), args); }
/** * SUM returns Long when applied to state-fields of integral types (other than BigInteger); Double * when applied to state-fields of floating point types; BigInteger when applied to state-fields * of type BigInteger; and BigDecimal when applied to state-fields of type BigDecimal. */ public static <D extends Number & Comparable<? super D>> NumberExpression<?> sum( Expression<D> left) { Class<?> type = left.getType(); if (type.equals(Byte.class) || type.equals(Integer.class) || type.equals(Short.class)) { type = Long.class; } else if (type.equals(Float.class)) { type = Double.class; } return NumberOperation.create((Class<D>) type, Ops.AggOps.SUM_AGG, left); }
@SuppressWarnings("unchecked") @Override public <RT> ListSubQuery<RT> list(Expression<RT> projection) { return new ListSubQuery<RT>((Class) projection.getType(), projection(projection)); }
@SuppressWarnings("unchecked") @Override public <RT> SimpleSubQuery<RT> unique(Expression<RT> projection) { return new SimpleSubQuery<RT>((Class) projection.getType(), uniqueProjection(projection)); }
public GAvg(Expression<T> expr) { super((Class) expr.getType(), expr); }
@Override public Class getType() { return projection.getType(); }
public T addFlag(Position position, String prefix, Expression<?> expr) { Expression<?> flag = SimpleTemplate.create(expr.getType(), prefix + "{0}", expr); return queryMixin.addFlag(new QueryFlag(position, flag)); }