Author: doogie
Date: Wed Nov 18 02:55:59 2009 New Revision: 881653 URL: http://svn.apache.org/viewvc?rev=881653&view=rev Log: Reworked, no more unchecked warnings, nor suppressions. Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/sql/EntityPlanner.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/sql/SQLUtil.java ofbiz/trunk/framework/sql/src/org/ofbiz/sql/Main.java ofbiz/trunk/framework/sql/src/org/ofbiz/sql/Parser.jj ofbiz/trunk/framework/sql/src/org/ofbiz/sql/Planner.java ofbiz/trunk/framework/sql/src/org/ofbiz/sql/SQLDelete.java ofbiz/trunk/framework/sql/src/org/ofbiz/sql/SQLInsert.java ofbiz/trunk/framework/sql/src/org/ofbiz/sql/SQLSelect.java ofbiz/trunk/framework/sql/src/org/ofbiz/sql/SQLStatement.java ofbiz/trunk/framework/sql/src/org/ofbiz/sql/SQLUpdate.java ofbiz/trunk/framework/sql/src/org/ofbiz/sql/SQLView.java Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/sql/EntityPlanner.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/sql/EntityPlanner.java?rev=881653&r1=881652&r2=881653&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/sql/EntityPlanner.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/sql/EntityPlanner.java Wed Nov 18 02:55:59 2009 @@ -68,15 +68,15 @@ super(new EntityConditionPlanner()); } - public EntityDeletePlan plan(SQLDelete<?> deleteStatement) { + public EntityDeletePlan planDelete(SQLDelete deleteStatement) { return null; } - public EntityInsertPlan plan(SQLInsert<?> insertStatement) { + public EntityInsertPlan planInsert(SQLInsert insertStatement) { return null; } - public EntitySelectPlan plan(SQLSelect<?> selectStatement) { + public EntitySelectPlan planSelect(SQLSelect selectStatement) { DynamicViewEntity dve = new DynamicViewEntity(); Table table = selectStatement.getTable(); addMember(dve, table.getTableName()); @@ -97,11 +97,11 @@ return new EntitySelectPlan(dve, plan(selectStatement.getWhereCondition()), plan(selectStatement.getHavingCondition()), selectStatement.getOrderBy()); } - public EntityUpdatePlan plan(SQLUpdate<?> updateStatement) { + public EntityUpdatePlan planUpdate(SQLUpdate updateStatement) { return null; } - public EntityViewPlan plan(SQLView<?> viewStatement) { + public EntityViewPlan planView(SQLView viewStatement) { return null; } Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/sql/SQLUtil.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/sql/SQLUtil.java?rev=881653&r1=881652&r2=881653&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/sql/SQLUtil.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/sql/SQLUtil.java Wed Nov 18 02:55:59 2009 @@ -29,7 +29,7 @@ private static final EntityPlanner planner = new EntityPlanner(); public static EntitySelectPlan parseSelect(String sql) throws ParseException { - return planner.plan(new Parser(new StringReader(sql)).SelectStatement()); + return planner.planSelect(new Parser(new StringReader(sql)).SelectStatement()); } /* public static EntityCondition parseCondition(String condition) throws ParseException { Modified: ofbiz/trunk/framework/sql/src/org/ofbiz/sql/Main.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/sql/src/org/ofbiz/sql/Main.java?rev=881653&r1=881652&r2=881653&view=diff ============================================================================== --- ofbiz/trunk/framework/sql/src/org/ofbiz/sql/Main.java (original) +++ ofbiz/trunk/framework/sql/src/org/ofbiz/sql/Main.java Wed Nov 18 02:55:59 2009 @@ -24,15 +24,15 @@ public final class Main { public static void main(String[] args) throws Exception { Planner<?, ?, ?, ?, ?, ?, ?> planner = new DebugPlanner(); - List<SQLStatement<?, ?>> statements = new Parser(System.in).SQLFile(); - for (SQLStatement<?, ?> statement: statements) { + List<SQLStatement<?>> statements = new Parser(System.in).SQLFile(); + for (SQLStatement<?> statement: statements) { run(statement, planner); } } private static final void run(SQLStatement statement, Planner planner) { System.err.println(statement); - SQLPlan plan = statement.plan(planner); + SQLPlan plan = planner.plan(statement); System.err.println("\tplan=" + plan); } @@ -41,23 +41,23 @@ super(new DebugConditionPlanner()); } - public DebugDeletePlan plan(SQLDelete deleteStatement) { + public DebugDeletePlan planDelete(SQLDelete deleteStatement) { return null; } - public DebugInsertPlan plan(SQLInsert insertStatement) { + public DebugInsertPlan planInsert(SQLInsert insertStatement) { return null; } - public DebugSelectPlan plan(SQLSelect selectStatement) { + public DebugSelectPlan planSelect(SQLSelect selectStatement) { return null; } - public DebugUpdatePlan plan(SQLUpdate updateStatement) { + public DebugUpdatePlan planUpdate(SQLUpdate updateStatement) { return null; } - public DebugViewPlan plan(SQLView viewStatement) { + public DebugViewPlan planView(SQLView viewStatement) { return null; } } Modified: ofbiz/trunk/framework/sql/src/org/ofbiz/sql/Parser.jj URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/sql/src/org/ofbiz/sql/Parser.jj?rev=881653&r1=881652&r2=881653&view=diff ============================================================================== --- ofbiz/trunk/framework/sql/src/org/ofbiz/sql/Parser.jj (original) +++ ofbiz/trunk/framework/sql/src/org/ofbiz/sql/Parser.jj Wed Nov 18 02:55:59 2009 @@ -162,10 +162,10 @@ // ------------------- -public List<SQLStatement<?, ?>> SQLFile(): +public List<SQLStatement<?>> SQLFile(): { - List<SQLStatement<?, ?>> list = FastList.newInstance(); - SQLStatement<?, ?> statement; + List<SQLStatement<?>> list = FastList.newInstance(); + SQLStatement<?> statement; } { ( statement=Statement() ( <SEMI> )? { list.add(statement); } )* Modified: ofbiz/trunk/framework/sql/src/org/ofbiz/sql/Planner.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/sql/src/org/ofbiz/sql/Planner.java?rev=881653&r1=881652&r2=881653&view=diff ============================================================================== --- ofbiz/trunk/framework/sql/src/org/ofbiz/sql/Planner.java (original) +++ ofbiz/trunk/framework/sql/src/org/ofbiz/sql/Planner.java Wed Nov 18 02:55:59 2009 @@ -37,9 +37,18 @@ } } - public abstract D plan(SQLDelete<?> deleteStatement); - public abstract I plan(SQLInsert<?> insertStatement); - public abstract S plan(SQLSelect<?> selectStatement); - public abstract U plan(SQLUpdate<?> updateStatement); - public abstract V plan(SQLView<?> viewStatement); + public SQLPlan<?> plan(SQLStatement statement) { + if (statement instanceof SQLDelete) return planDelete((SQLDelete) statement); + if (statement instanceof SQLInsert) return planInsert((SQLInsert) statement); + if (statement instanceof SQLSelect) return planSelect((SQLSelect) statement); + if (statement instanceof SQLUpdate) return planUpdate((SQLUpdate) statement); + if (statement instanceof SQLView) return planView((SQLView) statement); + return null; + } + + public abstract D planDelete(SQLDelete deleteStatement); + public abstract I planInsert(SQLInsert insertStatement); + public abstract S planSelect(SQLSelect selectStatement); + public abstract U planUpdate(SQLUpdate updateStatement); + public abstract V planView(SQLView viewStatement); } Modified: ofbiz/trunk/framework/sql/src/org/ofbiz/sql/SQLDelete.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/sql/src/org/ofbiz/sql/SQLDelete.java?rev=881653&r1=881652&r2=881653&view=diff ============================================================================== --- ofbiz/trunk/framework/sql/src/org/ofbiz/sql/SQLDelete.java (original) +++ ofbiz/trunk/framework/sql/src/org/ofbiz/sql/SQLDelete.java Wed Nov 18 02:55:59 2009 @@ -18,7 +18,7 @@ */ package org.ofbiz.sql; -public final class SQLDelete<P extends DeletePlan<P>> extends SQLStatement<SQLDelete<P>, P> { +public final class SQLDelete extends SQLStatement<SQLDelete> { private final Table table; private final Condition whereCondition; @@ -27,11 +27,6 @@ this.whereCondition = whereCondition; } - @SuppressWarnings("unchecked") - public <PP extends P> PP plan(Planner<?, ?, ?, ?, ?, ?, ?> planner) { - return (PP) planner.plan(this); - } - public Table getTable() { return table; } Modified: ofbiz/trunk/framework/sql/src/org/ofbiz/sql/SQLInsert.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/sql/src/org/ofbiz/sql/SQLInsert.java?rev=881653&r1=881652&r2=881653&view=diff ============================================================================== --- ofbiz/trunk/framework/sql/src/org/ofbiz/sql/SQLInsert.java (original) +++ ofbiz/trunk/framework/sql/src/org/ofbiz/sql/SQLInsert.java Wed Nov 18 02:55:59 2009 @@ -24,7 +24,7 @@ import org.ofbiz.base.util.StringUtil; import org.ofbiz.base.util.UtilGenerics; -public final class SQLInsert<P extends InsertPlan<P>> extends SQLStatement<SQLInsert<P>, P> { +public final class SQLInsert extends SQLStatement<SQLInsert> { private final TableName tableName; private final InsertSource source; private final List<String> columns; @@ -35,11 +35,6 @@ this.columns = columns; } - @SuppressWarnings("unchecked") - public <PP extends P> PP plan(Planner<?, ?, ?, ?, ?, ?, ?> planner) { - return (PP) planner.plan(this); - } - public TableName getTableName() { return tableName; } Modified: ofbiz/trunk/framework/sql/src/org/ofbiz/sql/SQLSelect.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/sql/src/org/ofbiz/sql/SQLSelect.java?rev=881653&r1=881652&r2=881653&view=diff ============================================================================== --- ofbiz/trunk/framework/sql/src/org/ofbiz/sql/SQLSelect.java (original) +++ ofbiz/trunk/framework/sql/src/org/ofbiz/sql/SQLSelect.java Wed Nov 18 02:55:59 2009 @@ -26,7 +26,7 @@ import org.ofbiz.base.util.StringUtil; -public final class SQLSelect<P extends SelectPlan<P>> extends SQLStatement<SQLSelect<P>, P> implements InsertSource { +public final class SQLSelect extends SQLStatement<SQLSelect> implements InsertSource { private final List<FieldAll> fieldAlls; private final Map<String, FieldDef> fieldDefs; private final Table table; @@ -51,11 +51,6 @@ this.limit = limit; } - @SuppressWarnings("unchecked") - public <PP extends P> PP plan(Planner<?, ?, ?, ?, ?, ?, ?> planner) { - return (PP) planner.plan(this); - } - public Collection<FieldAll> getFieldAlls() { return fieldAlls; } Modified: ofbiz/trunk/framework/sql/src/org/ofbiz/sql/SQLStatement.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/sql/src/org/ofbiz/sql/SQLStatement.java?rev=881653&r1=881652&r2=881653&view=diff ============================================================================== --- ofbiz/trunk/framework/sql/src/org/ofbiz/sql/SQLStatement.java (original) +++ ofbiz/trunk/framework/sql/src/org/ofbiz/sql/SQLStatement.java Wed Nov 18 02:55:59 2009 @@ -18,6 +18,5 @@ */ package org.ofbiz.sql; -public abstract class SQLStatement<S extends SQLStatement<S, P>, P extends SQLPlan<P>> extends Atom { - public abstract <PP extends P> PP plan(Planner<?, ?, ?, ?, ?, ?, ?> planner); +public abstract class SQLStatement<S extends SQLStatement<S>> extends Atom { } Modified: ofbiz/trunk/framework/sql/src/org/ofbiz/sql/SQLUpdate.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/sql/src/org/ofbiz/sql/SQLUpdate.java?rev=881653&r1=881652&r2=881653&view=diff ============================================================================== --- ofbiz/trunk/framework/sql/src/org/ofbiz/sql/SQLUpdate.java (original) +++ ofbiz/trunk/framework/sql/src/org/ofbiz/sql/SQLUpdate.java Wed Nov 18 02:55:59 2009 @@ -23,7 +23,7 @@ import org.ofbiz.base.util.StringUtil; -public final class SQLUpdate<P extends UpdatePlan<P>> extends SQLStatement<SQLUpdate<P>, P> implements Iterable<SetField> { +public final class SQLUpdate extends SQLStatement<SQLUpdate> implements Iterable<SetField> { private final Table table; private final List<SetField> setFields; private final Condition whereCondition; @@ -34,11 +34,6 @@ this.whereCondition = whereCondition; } - @SuppressWarnings("unchecked") - public <PP extends P> PP plan(Planner<?, ?, ?, ?, ?, ?, ?> planner) { - return (PP) planner.plan(this); - } - public Table getTable() { return table; } Modified: ofbiz/trunk/framework/sql/src/org/ofbiz/sql/SQLView.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/sql/src/org/ofbiz/sql/SQLView.java?rev=881653&r1=881652&r2=881653&view=diff ============================================================================== --- ofbiz/trunk/framework/sql/src/org/ofbiz/sql/SQLView.java (original) +++ ofbiz/trunk/framework/sql/src/org/ofbiz/sql/SQLView.java Wed Nov 18 02:55:59 2009 @@ -18,7 +18,7 @@ */ package org.ofbiz.sql; -public final class SQLView<P extends ViewPlan<P>> extends SQLStatement<SQLView<P>, P> { +public final class SQLView extends SQLStatement<SQLView> { private final String name; private final SQLSelect sqlSelect; @@ -27,11 +27,6 @@ this.sqlSelect = sqlSelect; } - @SuppressWarnings("unchecked") - public <PP extends P> PP plan(Planner<?, ?, ?, ?, ?, ?, ?> planner) { - return (PP) planner.plan(this); - } - public String getName() { return name; } |
Free forum by Nabble | Edit this page |