Skip to content

Commit

Permalink
completed ExpressionVisitorAdapter
Browse files Browse the repository at this point in the history
  • Loading branch information
wumpz committed Jun 5, 2015
1 parent 94c6355 commit 348fd7f
Showing 1 changed file with 38 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,46 @@
import net.sf.jsqlparser.expression.operators.relational.*;
import net.sf.jsqlparser.schema.Column;
import net.sf.jsqlparser.statement.select.OrderByElement;
import net.sf.jsqlparser.statement.select.PivotVisitor;
import net.sf.jsqlparser.statement.select.SelectVisitor;
import net.sf.jsqlparser.statement.select.SubSelect;
import net.sf.jsqlparser.statement.select.WithItem;

public class ExpressionVisitorAdapter implements ExpressionVisitor, ItemsListVisitor {

private SelectVisitor selectVisitor;

public SelectVisitor getSelectVisitor() {
return selectVisitor;
}

public void setSelectVisitor(SelectVisitor selectVisitor) {
this.selectVisitor = selectVisitor;
}

private PivotVisitor pivotVisitor;

public PivotVisitor getPivotVisitor() {
return pivotVisitor;
}

public void setPivotVisitor(PivotVisitor pivotVisitor) {
this.pivotVisitor = pivotVisitor;
}

@Override
public void visit(NullValue value) {

}

@Override
public void visit(Function function) {

if (function.getParameters() != null) {
function.getParameters().accept(this);
}
if (function.getKeep() != null) {
function.getKeep().accept(this);
}
}

@Override
Expand Down Expand Up @@ -182,7 +210,15 @@ public void visit(Column column) {

@Override
public void visit(SubSelect subSelect) {

if (selectVisitor != null) {
for (WithItem item : subSelect.getWithItemsList()) {
item.accept(selectVisitor);
}
}
subSelect.getSelectBody().accept(selectVisitor);
if (pivotVisitor != null && subSelect.getPivot() != null) {
subSelect.getPivot().accept(pivotVisitor);
}
}

@Override
Expand Down Expand Up @@ -274,7 +310,6 @@ public void visit(ExtractExpression expr) {

@Override
public void visit(IntervalExpression expr) {

}

@Override
Expand Down

0 comments on commit 348fd7f

Please sign in to comment.