com.jpattern.orm.query.SetClause Maven / Gradle / Ivy
package com.jpattern.orm.query;
import java.util.ArrayList;
import java.util.List;
import com.jpattern.orm.query.expression.EqExpressionElement;
/**
*
* @author Francesco Cina
*
* 10/lug/2011
*/
public class SetClause implements ISetClause {
/**
*
*/
List elementList = new ArrayList();
private INameSolver nameSolver = new NullNameSolver();
@Override
public ISetClause eq(String property, Object value) {
IExpressionElement expressionElement = new EqExpressionElement(property, value);
expressionElement.setNameSolver(nameSolver);
elementList.add(expressionElement);
return this;
}
@Override
public String renderSql() {
StringBuilder StringBuilder = new StringBuilder();
renderSql(StringBuilder);
return StringBuilder.toString();
}
@Override
public void renderSql(StringBuilder StringBuilder) {
boolean first = true;
if (!elementList.isEmpty()) {
StringBuilder.append("SET ");
for (IExpressionElement expressionElement : elementList) {
if (!first) {
StringBuilder.append(", ");
}
expressionElement.renderSql(StringBuilder);
first = false;
}
}
}
@Override
public void appendValues(List
© 2015 - 2025 Weber Informatics LLC | Privacy Policy