All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.rapleaf.jack.queries.JoinConditionBuilder Maven / Gradle / Ivy

There is a newer version: 1.8
Show newest version
package com.rapleaf.jack.queries;

import java.util.List;

import com.google.common.collect.Lists;

public class JoinConditionBuilder {
  private final GenericQuery genericQuery;
  private final JoinType joinType;
  private final Table table;

  JoinConditionBuilder(GenericQuery genericQuery, JoinType joinType, Table table) {
    this.genericQuery = genericQuery;
    this.joinType = joinType;
    this.table = table;
  }

  public GenericQuery on(GenericConstraint constraint, GenericConstraint... constraints) {
    List joinConstraints = Lists.newArrayList(constraint);
    genericQuery.addParameters(constraint.getParameters());
    for (GenericConstraint genericConstraint : constraints) {
      joinConstraints.add(genericConstraint);
      genericQuery.addParameters(genericConstraint.getParameters());
    }
    genericQuery.addJoinCondition(new JoinCondition(joinType, table, joinConstraints));
    return genericQuery;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy