com.jpattern.orm.query.where.InSubQueryExpressionElement Maven / Gradle / Ivy
package com.jpattern.orm.query.where;
import java.util.List;
import com.jpattern.orm.query.INameSolver;
import com.jpattern.orm.query.BaseFindQuery;
/**
*
* @author Francesco Cina
*
* 26/giu/2011
*/
public class InSubQueryExpressionElement implements ExpressionElement {
/**
*
*/
private final BaseFindQuery query;
private INameSolver nameSolver;
private final String property;
private final boolean in;
public InSubQueryExpressionElement(String property, BaseFindQuery query, boolean in) {
this.property = property;
this.query = query;
this.in = in;
}
@Override
public String renderSql() {
StringBuilder StringBuilder = new StringBuilder();
renderSql(StringBuilder);
return StringBuilder.toString();
}
@Override
public void renderSql(StringBuilder StringBuilder) {
StringBuilder.append( nameSolver.solvePropertyName( property ) );
if (in) {
StringBuilder.append( " IN ( ");
} else {
StringBuilder.append( " NOT IN ( ");
}
query.renderSql(StringBuilder);
StringBuilder.append(") ");
}
@Override
public void setNameSolver(INameSolver nameSolver) {
this.nameSolver = nameSolver;
}
@Override
public void appendValues(List
© 2015 - 2024 Weber Informatics LLC | Privacy Policy