Permalink
Browse files

Use of generics

- List of expressions in ItemsList
- List of columns in Statement
- List of joins in PlainSelect
- List of withItems in Select
- List of plainSelects in Union
- List of orderByElements in Union
- List of columns in Update
- List of expressions in Update
  • Loading branch information...
1 parent 1db31a4 commit 8b0b865780ee962f4c3cc768aa1ffce83772f108 Florent Bécart committed Jun 20, 2011
@@ -24,26 +24,27 @@
import java.util.List;
+import net.sf.jsqlparser.expression.Expression;
import net.sf.jsqlparser.statement.select.PlainSelect;
/**
* A list of expressions, as in SELECT A FROM TAB WHERE B IN (expr1,expr2,expr3)
*/
public class ExpressionList implements ItemsList {
- private List expressions;
+ private List<Expression> expressions;
public ExpressionList() {
}
- public ExpressionList(List expressions) {
+ public ExpressionList(List<Expression> expressions) {
this.expressions = expressions;
}
- public List getExpressions() {
+ public List<Expression> getExpressions() {
return expressions;
}
- public void setExpressions(List list) {
+ public void setExpressions(List<Expression> list) {
expressions = list;
}
@@ -25,6 +25,7 @@
import java.util.List;
import net.sf.jsqlparser.expression.operators.relational.ItemsList;
+import net.sf.jsqlparser.schema.Column;
import net.sf.jsqlparser.schema.Table;
import net.sf.jsqlparser.statement.Statement;
import net.sf.jsqlparser.statement.StatementVisitor;
@@ -35,7 +36,7 @@
*/
public class Insert implements Statement {
private Table table;
- private List columns;
+ private List<Column> columns;
private ItemsList itemsList;
private boolean useValues = true;
@@ -56,11 +57,11 @@ public void setTable(Table name) {
*
* @return a list of {@link net.sf.jsqlparser.schema.Column}
*/
- public List getColumns() {
+ public List<Column> getColumns() {
return columns;
}
- public void setColumns(List list) {
+ public void setColumns(List<Column> list) {
columns = list;
}
@@ -38,7 +38,7 @@
private List selectItems;
private Table into;
private FromItem fromItem;
- private List joins;
+ private List<Join> joins;
private Expression where;
private List groupByColumnReferences;
private List orderByElements;
@@ -93,11 +93,11 @@ public void setWhere(Expression where) {
*
* @return the list of {@link Join}s
*/
- public List getJoins() {
+ public List<Join> getJoins() {
return joins;
}
- public void setJoins(List list) {
+ public void setJoins(List<Join> list) {
joins = list;
}
@@ -30,7 +30,7 @@
public class Select implements Statement {
private SelectBody selectBody;
- private List withItemsList;
+ private List<WithItem> withItemsList;
public void accept(StatementVisitor statementVisitor) {
statementVisitor.visit(this);
@@ -48,7 +48,7 @@ public String toString() {
StringBuffer retval = new StringBuffer();
if (withItemsList != null && !withItemsList.isEmpty()) {
retval.append("WITH ");
- for (Iterator iter = withItemsList.iterator(); iter.hasNext();) {
+ for (Iterator<WithItem> iter = withItemsList.iterator(); iter.hasNext();) {
WithItem withItem = (WithItem) iter.next();
retval.append(withItem);
if (iter.hasNext())
@@ -60,11 +60,11 @@ public String toString() {
return retval.toString();
}
- public List getWithItemsList() {
+ public List<WithItem> getWithItemsList() {
return withItemsList;
}
- public void setWithItemsList(List withItemsList) {
+ public void setWithItemsList(List<WithItem> withItemsList) {
this.withItemsList = withItemsList;
}
}
@@ -28,8 +28,8 @@
*/
public class Union implements SelectBody {
- private List plainSelects;
- private List orderByElements;
+ private List<PlainSelect> plainSelects;
+ private List<OrderByElement> orderByElements;
private Limit limit;
private boolean distinct;
private boolean all;
@@ -38,7 +38,7 @@ public void accept(SelectVisitor selectVisitor) {
selectVisitor.visit(this);
}
- public List getOrderByElements() {
+ public List<OrderByElement> getOrderByElements() {
return orderByElements;
}
@@ -47,15 +47,15 @@ public List getOrderByElements() {
*
* @return the list of {@link PlainSelect}s
*/
- public List getPlainSelects() {
+ public List<PlainSelect> getPlainSelects() {
return plainSelects;
}
- public void setOrderByElements(List orderByElements) {
+ public void setOrderByElements(List<OrderByElement> orderByElements) {
this.orderByElements = orderByElements;
}
- public void setPlainSelects(List list) {
+ public void setPlainSelects(List<PlainSelect> list) {
plainSelects = list;
}
@@ -25,6 +25,7 @@
import java.util.List;
import net.sf.jsqlparser.expression.Expression;
+import net.sf.jsqlparser.schema.Column;
import net.sf.jsqlparser.schema.Table;
import net.sf.jsqlparser.statement.Statement;
import net.sf.jsqlparser.statement.StatementVisitor;
@@ -35,8 +36,8 @@
public class Update implements Statement {
private Table table;
private Expression where;
- private List columns;
- private List expressions;
+ private List<Column> columns;
+ private List<Expression> expressions;
public void accept(StatementVisitor statementVisitor) {
statementVisitor.visit(this);
@@ -63,7 +64,7 @@ public void setWhere(Expression expression) {
*
* @return a list of {@link net.sf.jsqlparser.schema.Column}s
*/
- public List getColumns() {
+ public List<Column> getColumns() {
return columns;
}
@@ -72,15 +73,15 @@ public List getColumns() {
*
* @return a list of {@link Expression}s
*/
- public List getExpressions() {
+ public List<Expression> getExpressions() {
return expressions;
}
- public void setColumns(List list) {
+ public void setColumns(List<Column> list) {
columns = list;
}
- public void setExpressions(List list) {
+ public void setExpressions(List<Expression> list) {
expressions = list;
}

0 comments on commit 8b0b865

Please sign in to comment.