prompto.grammar.OrderByClauseList Maven / Gradle / Ivy
The newest version!
package prompto.grammar;
import prompto.compiler.Flags;
import prompto.compiler.MethodInfo;
import prompto.parser.Dialect;
import prompto.runtime.Context;
import prompto.store.IQueryBuilder;
import prompto.transpiler.Transpiler;
import prompto.utils.CodeWriter;
import prompto.utils.ObjectList;
@SuppressWarnings("serial")
public class OrderByClauseList extends ObjectList {
public OrderByClauseList() {
}
public OrderByClauseList(OrderByClause clause) {
this.add(clause);
}
public void toDialect(CodeWriter writer) {
writer.append("order by ");
if(writer.getDialect()==Dialect.O)
writer.append("( ");
for(OrderByClause clause : this) {
clause.toDialect(writer);
writer.append(", ");
}
writer.trimLast(2);
if(writer.getDialect()==Dialect.O)
writer.append(" )");
}
public IQueryBuilder interpretQuery(Context context, IQueryBuilder builder) {
for(OrderByClause clause : this)
builder = clause.interpretQuery(context, builder);
return builder;
}
public void compileQuery(Context context, MethodInfo method, Flags flags) {
this.forEach((clause)->
clause.compileQuery(context, method, flags));
}
public void declare(Transpiler transpiler) {
this.forEach(clause -> clause.declare(transpiler));
}
public void transpileQuery(Transpiler transpiler, String builderName) {
this.forEach(clause -> clause.transpileQuery(transpiler, builderName));
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy