com.mysema.query.types.Expression.getType()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(7.4k)|赞(0)|评价(0)|浏览(147)

本文整理了Java中com.mysema.query.types.Expression.getType()方法的一些代码示例,展示了Expression.getType()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Expression.getType()方法的具体详情如下:
包路径:com.mysema.query.types.Expression
类名称:Expression
方法名:getType

Expression.getType介绍

[英]Get the java type for this expression
[中]获取此表达式的java类型

代码示例

代码示例来源:origin: com.mysema.querydsl/querydsl-sql

@Override
  public RT produceNext(ResultSet rs) throws Exception {
    return get(rs, expr, 1, expr.getType());
  }
};

代码示例来源:origin: com.mysema.querydsl/querydsl-core

private <T extends Comparable> Cases<T, DateExpression<T>> thenDate(Expression<T> expr) {
  return new Cases<T, DateExpression<T>>((Class)expr.getType()) {
    @Override
    protected DateExpression<T> createResult(Class<T> type, Expression<T> last) {
      return DateOperation.create(type, Ops.CASE, last);
    }
  }.addCase(when, expr);
}

代码示例来源:origin: com.mysema.querydsl/querydsl-sql

/**
 * @param measureExpr
 * @param n
 * @return
 */
public static <T> WindowOver<T> nthValue(Expression<T> measureExpr, Expression<? extends Number> n) {
  return new WindowOver<T>((Class<T>)measureExpr.getType(), SQLOps.NTHVALUE, measureExpr, n);
}

代码示例来源:origin: com.mysema.querydsl/querydsl-lucene

@SuppressWarnings({"unchecked"})
protected Query range(Path<?> leftHandSide, String field, @Nullable Expression<?> min, 
    @Nullable Expression<?> max, boolean minInc, boolean maxInc, QueryMetadata metadata) {
  if (min != null && Number.class.isAssignableFrom(min.getType()) || max != null
      && Number.class.isAssignableFrom(max.getType())) {
    Class<? extends Number> numType = (Class) (min != null ? min.getType() : max.getType());
    return numericRange((Class) numType, field, (Number) (min == null ? null
        : ((Constant) min).getConstant()), (Number) (max == null ? null
        : ((Constant) max).getConstant()), minInc, maxInc);
  }
  return stringRange(leftHandSide, field, min, max, minInc, maxInc, metadata);
}

代码示例来源:origin: com.mysema.querydsl/querydsl-core

private <T extends Comparable> Cases<T, ComparableExpression<T>> thenComparable(Expression<T> expr) {
  return new Cases<T, ComparableExpression<T>>((Class)expr.getType()) {
    @Override
    protected ComparableExpression<T> createResult(Class<T> type, Expression<T> last) {
      return ComparableOperation.create(type, Ops.CASE, last);
    }
  }.addCase(when, expr);
}

代码示例来源:origin: com.mysema.querydsl/querydsl-core

@SuppressWarnings("unchecked")
private <T extends Enum<T>> Cases<T,EnumExpression<T>> thenEnum(Expression<T> expr) {
  return new Cases<T,EnumExpression<T>>((Class)expr.getType()) {
    @Override
    protected EnumExpression<T> createResult(Class<T> type, Expression<T> last) {
      return EnumOperation.create(type, Ops.CASE, last);
    }
  }.addCase(when, expr);
}

代码示例来源:origin: com.mysema.querydsl/querydsl-core

public static <D> ConstructorExpression<D> create(Class<D> type, Expression<?>... args) {
  Class<?>[] paramTypes = new Class[args.length];
  for (int i = 0; i < paramTypes.length; i++) {
    paramTypes[i] = args[i].getType();
  }
  return new ConstructorExpression<D>(type, paramTypes, args);
}

代码示例来源:origin: com.mysema.querydsl/querydsl-core

/**
 * Return the greater of the given values
 *
 * @return max(left, right)
 */
public static <A extends Number & Comparable<?>> NumberExpression<A> max(Expression<A> left, Expression<A> right) {
  return NumberOperation.create(left.getType(), MathOps.MAX, left, right);
}

代码示例来源:origin: com.mysema.querydsl/querydsl-sql

/**
 * expr evaluated at the row that is one row before the current row within the partition
 *
 * @param expr
 * @return
 */
public static <T> WindowOver<T> lag(Expression<T> expr) {
  return new WindowOver<T>((Class<T>)expr.getType(), SQLOps.LAG, expr);
}

代码示例来源:origin: com.mysema.querydsl/querydsl-sql

/**
 * returns the variance of expr
 *
 * @param expr
 * @return
 */
public static <T extends Number> WindowOver<T> variance(Expression<T> expr) {
  return new WindowOver<T>((Class<T>)expr.getType(), SQLOps.VARIANCE, expr);
}

代码示例来源:origin: com.mysema.querydsl/querydsl-sql

/**
 * returns the population variance of a set of numbers after discarding the nulls in this set.
 *
 * @param expr
 * @return
 */
public static <T extends Number> WindowOver<T> varPop(Expression<T> expr) {
  return new WindowOver<T>((Class<T>)expr.getType(), SQLOps.VARPOP, expr);
}

代码示例来源:origin: com.mysema.querydsl/querydsl-core

private <T extends Comparable> Cases<T, DateTimeExpression<T>> thenDateTime(Expression<T> expr) {
  return new Cases<T, DateTimeExpression<T>>((Class)expr.getType()) {
    @Override
    protected DateTimeExpression<T> createResult(Class<T> type, Expression<T> last) {
      return DateTimeOperation.create(type, Ops.CASE, last);
    }
  }.addCase(when, expr);
}

代码示例来源:origin: arnaudroger/SimpleFlatMapper

public EnumTupleOrdinalIndexedGetter(TupleElementKey key, final Class<E> enumType) {
  this.index = key.getIndex();
  this.type = key.getExpression().getType();
  this.values = enumType.getEnumConstants();
}

代码示例来源:origin: com.mysema.querydsl/querydsl-core

/**
 * Round to s decimal places
 *
 * @param num
 * @param s
 * @return
 */
public static <A extends Number & Comparable<?>> NumberExpression<A> round(Expression<A> num, int s) {
  return NumberOperation.create(num.getType(), MathOps.ROUND2, num, ConstantImpl.create(s));
}

代码示例来源:origin: com.mysema.querydsl/querydsl-core

public <T extends Number & Comparable<?>> Cases<T,NumberExpression<T>> thenNumber(Expression<T> then) {
  type = then.getType();
  return new Cases<T,NumberExpression<T>>() {
    @SuppressWarnings("unchecked")
    @Override
    protected NumberExpression<T> createResult(Class<T> type, Expression<T> last) {
      return NumberOperation.create(type, Ops.CASE_EQ, base, last);
    }
  }.when(other).then(then);
}

代码示例来源:origin: com.mysema.querydsl/querydsl-core

@SuppressWarnings("unchecked")
@Override
public <RT> ListSubQuery<RT> list(Expression<RT> projection) {
  return new ListSubQuery<RT>((Class)projection.getType(), projection(projection));
}

代码示例来源:origin: com.mysema.querydsl/querydsl-core

@SuppressWarnings("unchecked")
@Override
public <RT> SimpleSubQuery<RT> unique(Expression<RT> projection) {
  return new SimpleSubQuery<RT>((Class)projection.getType(), uniqueProjection(projection));
}

代码示例来源:origin: com.mysema.querydsl/querydsl-sql

private <RT> RT newInstance(FactoryExpression<RT> c, ResultSet rs, int offset)
  throws InstantiationException, IllegalAccessException, InvocationTargetException, SQLException{
  Object[] args = new Object[c.getArgs().size()];
  for (int i = 0; i < args.length; i++) {
    args[i] = get(rs, c.getArgs().get(i), offset + i + 1, c.getArgs().get(i).getType());
  }
  return c.newInstance(args);
}

代码示例来源:origin: com.mysema.querydsl/querydsl-sql

@SuppressWarnings("unchecked")
public Predicate on(RelationalPath<E> entity) {
  BooleanBuilder builder = new BooleanBuilder();
  for (int i = 0; i < localColumns.size(); i++) {
    Expression<Object> local = (Expression<Object>)localColumns.get(i);
    Expression<?> foreign = new PathImpl(local.getType(), entity, foreignColumns.get(i));
    builder.and(ExpressionUtils.eq(local,foreign));
  }
  return builder.getValue();
}

代码示例来源:origin: com.mysema.querydsl/querydsl-core

/**
 * Get the result of the operation this / right
 *
 * @param right
 * @return this / right
 */
public <N extends Number & Comparable<?>> NumberExpression<T> divide(Expression<N> right) {
  Class<?> type = getDivisionType(getType(), right.getType());
  return NumberOperation.create((Class<T>)type, Ops.DIV, mixin, right);
}

相关文章