br.com.objectos.way.sql.AbstractSimpleSelectWhere1 Maven / Gradle / Ivy
package br.com.objectos.way.sql;
import br.com.objectos.way.db.Condition;
import br.com.objectos.way.db.Dialect;
import br.com.objectos.way.db.IntTypeColumn;
import br.com.objectos.way.db.LocalDateTypeColumn;
import br.com.objectos.way.db.Order;
import br.com.objectos.way.db.Orderable;
import br.com.objectos.way.db.ParameterBinder;
import br.com.objectos.way.db.SelectBuilder;
import br.com.objectos.way.db.Selectable;
import br.com.objectos.way.db.StringTypeColumn;
import javax.annotation.Generated;
@Generated("br.com.objectos.way.sql.BootProcessor")
abstract class AbstractSimpleSelectWhere1 extends SelectNode> implements SimpleSelectWhere> {
private Condition condition;
public AbstractSimpleSelectWhere1(SelectNode> previous) {
super(previous);
}
@Override
public SimpleSelectWhere1Int and(X column) {
setCondition();
return new SimpleSelectWhere1Int<>(this, Keyword.AND, column);
}
@Override
public SimpleSelectWhere1LocalDate and(X column) {
setCondition();
return new SimpleSelectWhere1LocalDate<>(this, Keyword.AND, column);
}
@Override
public SimpleSelectWhere1String and(X column) {
setCondition();
return new SimpleSelectWhere1String<>(this, Keyword.AND, column);
}
@Override
public SimpleSelectQuery1 compile(Dialect dialect) {
setCondition();
return new SimpleSelectQuery1<>(dialect, this);
}
@Override
public SimpleSelectOrderBy1 orderBy(Orderable o1) {
return orderBy(o1.asc());
}
@Override
public SimpleSelectOrderBy1 orderBy(Order o1) {
return orderBy0(o1);
}
@Override
ParameterBinder bind0(ParameterBinder binder) {
if (condition != null) {
condition.bind(binder);
}
return binder;
}
abstract Condition condition();
@Override
SelectBuilder write0(SelectBuilder sql) {
return condition != null ? sql.where(condition) : sql;
}
private SimpleSelectOrderBy1 orderBy0(Order... columns) {
setCondition();
return new SimpleSelectOrderBy1<>(this, columns);
}
private void setCondition() {
condition = condition();
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy