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