Пример #1
0
  /**
   * Initializes {@link org.lightmare.criteria.query.LambdaStream} implementation implementation for
   * JOIN expression
   *
   * @param parent
   * @param alias
   * @param joinType
   * @return L {@link org.lightmare.criteria.query.LambdaStream} implementation
   */
  protected static <P, E, S extends LambdaStream<E, ? super S>> S initJoinQuery(
      AbstractQueryStream<P, ?, ?> parent, String alias, Class<E> joinType) {

    S joinQuery;

    if (alias == null) {
      joinQuery = ObjectUtils.applyAndCast(joinType, c -> new JdbcJoinProcessor<E, P>(parent, c));
    } else {
      joinQuery =
          ObjectUtils.applyAndCast(joinType, c -> new JdbcJoinProcessor<E, P>(parent, alias, c));
    }

    return joinQuery;
  }
Пример #2
0
 /**
  * Initializes {@link org.lightmare.criteria.query.LambdaStream} implementation implementation for
  * sub query expressions
  *
  * @param parent
  * @param subType
  * @return L {@link org.lightmare.criteria.query.LambdaStream} implementation
  */
 protected static <P, E, S extends QueryStream<E, ? super S>> S initSubQuery(
     AbstractQueryStream<P, ?, ?> parent, Class<E> subType) {
   S query = ObjectUtils.applyAndCast(subType, c -> new JdbcSubQueryStream<E, P>(parent, c));
   return query;
 }
Пример #3
0
 /**
  * Clones passed {@link org.lightmare.criteria.tuples.QueryTuple} without throwing an exception
  *
  * @param instance
  * @return {@link org.lightmare.criteria.tuples.QueryTuple} clone
  */
 private static QueryTuple cloneTuple(QueryTuple instance) {
   return ObjectUtils.applyAndCast(instance, c -> ObjectUtils.applyQuietly(c, QueryTuple::clone));
 }