Пример #1
0
  @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);
  }
Пример #2
0
 /**
  * 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);
 }
Пример #3
0
 @SuppressWarnings("unchecked")
 @Override
 public <RT> ListSubQuery<RT> list(Expression<RT> projection) {
   return new ListSubQuery<RT>((Class) projection.getType(), projection(projection));
 }
Пример #4
0
 @SuppressWarnings("unchecked")
 @Override
 public <RT> SimpleSubQuery<RT> unique(Expression<RT> projection) {
   return new SimpleSubQuery<RT>((Class) projection.getType(), uniqueProjection(projection));
 }
Пример #5
0
 public GAvg(Expression<T> expr) {
   super((Class) expr.getType(), expr);
 }
Пример #6
0
 @Override
 public Class getType() {
   return projection.getType();
 }
Пример #7
0
 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));
 }