db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tfisc...@apache.org
Subject svn commit: r1003834 [1/2] - in /db/torque/torque4/trunk: torque-runtime/src/main/java/org/apache/torque/dsfactory/ torque-runtime/src/main/java/org/apache/torque/map/ torque-runtime/src/main/java/org/apache/torque/oid/ torque-runtime/src/main/java/org...
Date Sat, 02 Oct 2010 16:51:33 GMT
Author: tfischer
Date: Sat Oct  2 16:51:32 2010
New Revision: 1003834

URL: http://svn.apache.org/viewvc?rev=1003834&view=rev
Log:
TORQUE-150: use generics in runtime

Removed:
    db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/java5Wrappers.vm
Modified:
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/dsfactory/AbstractDataSourceFactory.java
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/dsfactory/JndiDataSourceFactory.java
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/map/ColumnMap.java
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/map/DatabaseMap.java
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/map/TableMap.java
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/oid/IDBroker.java
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/oid/IDGeneratorFactory.java
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/om/ComboKey.java
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/om/NumberKey.java
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/om/ObjectKey.java
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/BasePeer.java
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/CountHelper.java
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/Criteria.java
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/JoinBuilder.java
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/LargeSelect.java
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/Query.java
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/SQLBuilder.java
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/SqlExpression.java
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/SummaryHelper.java
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/UniqueList.java
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/functions/AbstractFunction.java
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/functions/Aggregate.java
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/functions/FunctionFactory.java
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/functions/SQLFunction.java
    db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMForeignKeyTransformer.java
    db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/conf/options.properties
    db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/outlets/peer.xml
    db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/dbObject/base/bean/objectBeanMethods.vm
    db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/dbObject/base/copyMethods.vm
    db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/dbObject/base/getByNameMethods.vm
    db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/manager/base/baseManager.vm
    db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/basePeer.vm
    db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/dbObjectClassConstants.vm
    db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/doSelect.vm
    db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/doSelectJoin.vm
    db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/doSelectJoinAllExcept.vm
    db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/doSelectVillageRecords.vm
    db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/populateObjects.vm
    db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/resultSet2Objects.vm
    db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/retrieveByPK.vm
    db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/retrieveByPKs.vm
    db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/DataTest.java

Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/dsfactory/AbstractDataSourceFactory.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/dsfactory/AbstractDataSourceFactory.java?rev=1003834&r1=1003833&r2=1003834&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/dsfactory/AbstractDataSourceFactory.java (original)
+++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/dsfactory/AbstractDataSourceFactory.java Sat Oct  2 16:51:32 2010
@@ -96,7 +96,7 @@ public abstract class AbstractDataSource
         }
 
         String key = property;
-        Class dsClass = ds.getClass();
+        Class<?> dsClass = ds.getClass();
         int dot = property.indexOf('.');
         try
         {
@@ -106,10 +106,10 @@ public abstract class AbstractDataSource
 
                 MappedPropertyDescriptor mappedPD =
                     new MappedPropertyDescriptor(property, dsClass);
-                Class propertyType = mappedPD.getMappedPropertyType();
+                Class<?> propertyType = mappedPD.getMappedPropertyType();
                 Configuration subProps = c.subset(property);
                 // use reflection to set properties
-                Iterator j = subProps.getKeys();
+                Iterator<?> j = subProps.getKeys();
                 while (j.hasNext())
                 {
                     String subProp = (String) j.next();
@@ -150,7 +150,7 @@ public abstract class AbstractDataSource
                 }
                 else
                 {
-                    Class propertyType =
+                    Class<?> propertyType =
                         PropertyUtils.getPropertyType(ds, property);
                     Object value =
                         ConvertUtils.convert(c.getString(property), propertyType);

Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/dsfactory/JndiDataSourceFactory.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/dsfactory/JndiDataSourceFactory.java?rev=1003834&r1=1003833&r2=1003834&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/dsfactory/JndiDataSourceFactory.java (original)
+++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/dsfactory/JndiDataSourceFactory.java Sat Oct  2 16:51:32 2010
@@ -151,8 +151,8 @@ public class JndiDataSourceFactory
 
         try
         {
-            Hashtable env = new Hashtable();
-            for (Iterator i = c.getKeys(); i.hasNext();)
+            Hashtable<String, Object> env = new Hashtable<String, Object>();
+            for (Iterator<?> i = c.getKeys(); i.hasNext();)
             {
                 String key = (String) i.next();
                 if (key.equals(PATH_KEY))
@@ -210,7 +210,7 @@ public class JndiDataSourceFactory
             Configuration c = configuration.subset(DATASOURCE_KEY);
             if (c != null)
             {
-                for (Iterator i = c.getKeys(); i.hasNext();)
+                for (Iterator<?> i = c.getKeys(); i.hasNext();)
                 {
                     String key = (String) i.next();
                     if (key.equals(CLASSNAME_KEY))
@@ -221,7 +221,7 @@ public class JndiDataSourceFactory
                             log.debug("Datasource class: " + classname);
                         }
 
-                        Class dsClass = Class.forName(classname);
+                        Class<?> dsClass = Class.forName(classname);
                         dataSource = dsClass.newInstance();
                     }
                     else
@@ -272,12 +272,12 @@ public class JndiDataSourceFactory
     private void debugCtx(Context ctx) throws NamingException
     {
         log.debug("InitialContext -------------------------------");
-        Map env = ctx.getEnvironment();
-        Iterator qw = env.entrySet().iterator();
+        Map<?, ?> env = ctx.getEnvironment();
+        Iterator<?> qw = env.entrySet().iterator();
         log.debug("Environment properties:" + env.size());
         while (qw.hasNext())
         {
-            Map.Entry entry = (Map.Entry) qw.next();
+            Map.Entry<?, ?> entry = (Map.Entry<?, ?>) qw.next();
             log.debug("    " + entry.getKey() + ": " + entry.getValue());
         }
         log.debug("----------------------------------------------");

Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/map/ColumnMap.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/map/ColumnMap.java?rev=1003834&r1=1003833&r2=1003834&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/map/ColumnMap.java (original)
+++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/map/ColumnMap.java Sat Oct  2 16:51:32 2010
@@ -21,10 +21,9 @@ package org.apache.torque.map;
 
 import java.util.Collections;
 import java.util.Iterator;
+import java.util.LinkedHashMap;
 import java.util.Map;
 
-import org.apache.commons.collections.map.ListOrderedMap;
-
 /**
  * ColumnMap is used to model a column of a table in a database.
  * <p>
@@ -106,8 +105,9 @@ public class ColumnMap implements java.i
     private boolean useInheritance;
 
     /** Associated of inheritance maps. */
-    private Map inheritanceMaps = Collections
-            .synchronizedMap(new ListOrderedMap());
+    private Map<String, InheritanceMap> inheritanceMaps
+            = Collections.synchronizedMap(
+                   new LinkedHashMap<String, InheritanceMap>());
 
     /** Java naming method the generator used. */
     private String javaNamingMethod;
@@ -119,8 +119,8 @@ public class ColumnMap implements java.i
     private int position = -1;
 
     /** Associated of inheritance maps. */
-    private Map optionsMap = Collections
-            .synchronizedMap(new ListOrderedMap());
+    private Map<String, String> optionsMap = Collections
+            .synchronizedMap(new LinkedHashMap<String, String>());
 
     /**
      * Constructor.
@@ -485,11 +485,11 @@ public class ColumnMap implements java.i
         InheritanceMap[] iMaps = new InheritanceMap[inheritanceMaps.size()];
         synchronized (inheritanceMaps)
         {
-            Iterator it = inheritanceMaps.values().iterator();
+            Iterator<InheritanceMap> it = inheritanceMaps.values().iterator();
             int i = 0;
             while (it.hasNext())
             {
-                iMaps[i++] = (InheritanceMap) it.next();
+                iMaps[i++] = it.next();
             }
         }
         return iMaps;
@@ -598,7 +598,7 @@ public class ColumnMap implements java.i
      */
     public InheritanceMap getInheritanceMap(String key)
     {
-        return (InheritanceMap) inheritanceMaps.get(key);
+        return inheritanceMaps.get(key);
     }
 
     /**
@@ -699,7 +699,7 @@ public class ColumnMap implements java.i
      *
      * @return A map containing all options, not null.
      */
-    public Map getOptions()
+    public Map<String, String> getOptions()
     {
         return Collections.unmodifiableMap(optionsMap);
     }
@@ -724,6 +724,6 @@ public class ColumnMap implements java.i
      */
     public String getOption(String key)
     {
-        return (String) optionsMap.get(key);
+        return optionsMap.get(key);
     }
 }

Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/map/DatabaseMap.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/map/DatabaseMap.java?rev=1003834&r1=1003833&r2=1003834&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/map/DatabaseMap.java (original)
+++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/map/DatabaseMap.java Sat Oct  2 16:51:32 2010
@@ -24,10 +24,10 @@ import java.text.MessageFormat;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.Iterator;
+import java.util.LinkedHashMap;
 import java.util.Map;
 import java.util.StringTokenizer;
 
-import org.apache.commons.collections.map.ListOrderedMap;
 import org.apache.commons.lang.StringUtils;
 import org.apache.torque.TorqueException;
 import org.apache.torque.adapter.IDMethod;
@@ -89,7 +89,8 @@ public class DatabaseMap implements java
     private String name;
 
     /** Name of the tables in the database. */
-    private Map tables;
+    private Map<String, TableMap> tables
+        = Collections.synchronizedMap(new LinkedHashMap<String, TableMap>());
 
     /**
      * A special table used to generate primary keys for the other
@@ -101,22 +102,21 @@ public class DatabaseMap implements java
     private IDBroker idBroker = null;
 
     /** The IdGenerators, keyed by type of idMethod. */
-    private HashMap idGenerators;
+    private Map<String, IdGenerator> idGenerators
+        = new HashMap<String, IdGenerator>(ID_GENERATORS_INITIAL_SIZE);
 
     /** Flag indicating that all tables have been loaded via initialize() */
     private boolean isInitialized = false;
 
-    /** Associated of inheritance maps. */
-    private Map optionsMap = Collections
-            .synchronizedMap(new ListOrderedMap());
+    /** Associated options. */
+    private Map<String, String> optionsMap
+            = Collections.synchronizedMap(new LinkedHashMap<String, String>());
 
     /**
      * Constructs a new DatabaseMap.
      */
     public DatabaseMap()
     {
-        tables = Collections.synchronizedMap(new ListOrderedMap());
-        idGenerators = new HashMap(ID_GENERATORS_INITIAL_SIZE);
     }
 
     /**
@@ -130,8 +130,6 @@ public class DatabaseMap implements java
     public DatabaseMap(String name, int numberOfTables)
     {
         this.name = name;
-        tables = Collections.synchronizedMap(new ListOrderedMap());
-        idGenerators = new HashMap(ID_GENERATORS_INITIAL_SIZE);
     }
 
     /**
@@ -144,8 +142,6 @@ public class DatabaseMap implements java
     public DatabaseMap(String name)
     {
         this.name = name;
-        tables = Collections.synchronizedMap(new ListOrderedMap());
-        idGenerators = new HashMap(ID_GENERATORS_INITIAL_SIZE);
     }
 
     /**
@@ -240,11 +236,11 @@ public class DatabaseMap implements java
         TableMap[] dbTables = new TableMap[tables.size()];
         synchronized (tables)
         {
-            Iterator it = tables.values().iterator();
+            Iterator<TableMap> it = tables.values().iterator();
             int i = 0;
             while (it.hasNext())
             {
-                dbTables[i++] = (TableMap) it.next();
+                dbTables[i++] = it.next();
             }
         }
         return dbTables;
@@ -313,7 +309,7 @@ public class DatabaseMap implements java
      *
      * @return A map containing all options, not null.
      */
-    public Map getOptions()
+    public Map<String, String> getOptions()
     {
         return Collections.unmodifiableMap(optionsMap);
     }
@@ -440,7 +436,7 @@ public class DatabaseMap implements java
                     javanameMethod(getName())
                 });
 
-        Class initClass = null;
+        Class<?> initClass = null;
         try
         {
             initClass = Class.forName(initClassName);

Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/map/TableMap.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/map/TableMap.java?rev=1003834&r1=1003833&r2=1003834&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/map/TableMap.java (original)
+++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/map/TableMap.java Sat Oct  2 16:51:32 2010
@@ -21,10 +21,10 @@ package org.apache.torque.map;
 
 import java.util.Collections;
 import java.util.Iterator;
+import java.util.LinkedHashMap;
 import java.util.Map;
 import java.util.StringTokenizer;
 
-import org.apache.commons.collections.map.ListOrderedMap;
 import org.apache.commons.lang.StringUtils;
 import org.apache.torque.adapter.IDMethod;
 import org.apache.torque.oid.IdGenerator;
@@ -49,7 +49,9 @@ public class TableMap implements IDMetho
     };
 
     /** The columns in the table. XML Order is preserved. */
-    private Map columns;
+    private Map<String, ColumnMap> columns
+            = Collections.synchronizedMap(
+                new LinkedHashMap<String, ColumnMap>());
 
     /** The database this table belongs to. */
     private DatabaseMap dbMap;
@@ -70,10 +72,10 @@ public class TableMap implements IDMetho
     private String description = "";
 
     /** The Peer Class for this table. */
-    private Class peerClass;
+    private Class<?> peerClass;
 
     /** The OM Root Class for this table. */
-    private Class omClass;
+    private Class<?> omClass;
 
     /** Whether any column uses Inheritance. */
     private boolean useInheritance = false;
@@ -82,7 +84,7 @@ public class TableMap implements IDMetho
     private boolean useManager = false;
 
     /** The associated cache manager class. */
-    private Class managerClass;
+    private Class<?> managerClass;
 
     /**
      * Object to store information that is needed if the
@@ -90,9 +92,9 @@ public class TableMap implements IDMetho
      */
     private Object pkInfo = null;
 
-    /** Associated of inheritance maps. */
-    private Map optionsMap = Collections
-            .synchronizedMap(new ListOrderedMap());
+    /** Associated options. */
+    private Map<String, String> optionsMap
+            = Collections.synchronizedMap(new LinkedHashMap<String, String>());
 
     /**
      * Required by proxy. Not used.
@@ -114,7 +116,6 @@ public class TableMap implements IDMetho
     {
         this.tableName = tableName;
         dbMap = containingDB;
-        columns = Collections.synchronizedMap(new ListOrderedMap());
     }
 
     /**
@@ -127,7 +128,6 @@ public class TableMap implements IDMetho
     {
         this.tableName = tableName;
         dbMap = containingDB;
-        columns = Collections.synchronizedMap(new ListOrderedMap());
     }
 
     /**
@@ -145,7 +145,6 @@ public class TableMap implements IDMetho
         this.tableName = tableName;
         this.prefix = prefix;
         dbMap = containingDB;
-        columns = Collections.synchronizedMap(new ListOrderedMap());
     }
 
     /**
@@ -195,12 +194,12 @@ public class TableMap implements IDMetho
     {
         synchronized (columns)
         {
-            Iterator it = columns.values().iterator();
+            Iterator<ColumnMap> it = columns.values().iterator();
             while (it.hasNext())
             {
                 Object theType = ((ColumnMap) it.next()).getType();
-            if (!(theType instanceof String || theType instanceof Number
-                    || theType instanceof java.util.Date))
+                if (!(theType instanceof String || theType instanceof Number
+                        || theType instanceof java.util.Date))
                 {
                     return true;
                 }
@@ -301,11 +300,11 @@ public class TableMap implements IDMetho
         ColumnMap[] tableColumns = new ColumnMap[columns.size()];
         synchronized (columns)
         {
-            Iterator it = columns.values().iterator();
+            Iterator<ColumnMap> it = columns.values().iterator();
             int i = 0;
             while (it.hasNext())
             {
-                tableColumns[i++] = (ColumnMap) it.next();
+                tableColumns[i++] = it.next();
             }
         }
         return tableColumns;
@@ -321,7 +320,7 @@ public class TableMap implements IDMetho
     {
         try
         {
-            return (ColumnMap) columns.get(name);
+            return columns.get(name);
         }
         catch (Exception e)
         {
@@ -679,7 +678,7 @@ public class TableMap implements IDMetho
      *
      * @return the OM class.
      */
-    public Class getOMClass()
+    public Class<?> getOMClass()
     {
         return omClass;
     }
@@ -689,7 +688,7 @@ public class TableMap implements IDMetho
      *
      * @param omClass The OM root class for this table.
      */
-    public void setOMClass(Class omClass)
+    public void setOMClass(Class<?> omClass)
     {
         this.omClass = omClass;
     }
@@ -699,7 +698,7 @@ public class TableMap implements IDMetho
      *
      * @return The peerClass for this table.
      */
-    public Class getPeerClass()
+    public Class<?> getPeerClass()
     {
         return peerClass;
     }
@@ -709,7 +708,7 @@ public class TableMap implements IDMetho
      *
      * @param peerClass The peerClass to set.
      */
-    public void setPeerClass(Class peerClass)
+    public void setPeerClass(Class<?> peerClass)
     {
         this.peerClass = peerClass;
     }
@@ -769,7 +768,7 @@ public class TableMap implements IDMetho
      *
      * @return the managerClass.
      */
-    public Class getManagerClass()
+    public Class<?> getManagerClass()
     {
         return managerClass;
     }
@@ -779,7 +778,7 @@ public class TableMap implements IDMetho
      *
      * @param managerClass the manager class for this table.
      */
-    public void setManagerClass(Class managerClass)
+    public void setManagerClass(Class<?> managerClass)
     {
         this.managerClass = managerClass;
     }
@@ -789,7 +788,7 @@ public class TableMap implements IDMetho
      *
      * @return A map containing all options, not null.
      */
-    public Map getOptions()
+    public Map<String, String> getOptions()
     {
         return Collections.unmodifiableMap(optionsMap);
     }
@@ -814,6 +813,6 @@ public class TableMap implements IDMetho
      */
     public String getOption(String key)
     {
-        return (String) optionsMap.get(key);
+        return optionsMap.get(key);
     }
 }

Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/oid/IDBroker.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/oid/IDBroker.java?rev=1003834&r1=1003833&r2=1003834&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/oid/IDBroker.java (original)
+++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/oid/IDBroker.java Sat Oct  2 16:51:32 2010
@@ -25,8 +25,8 @@ import java.sql.ResultSet;
 import java.sql.Statement;
 import java.util.ArrayList;
 import java.util.Hashtable;
-import java.util.Iterator;
 import java.util.List;
+import java.util.Map;
 
 import org.apache.commons.configuration.Configuration;
 import org.apache.commons.logging.Log;
@@ -121,7 +121,8 @@ public class IDBroker implements Runnabl
      * Key: String table name.
      * Value: List of Integer IDs.
      */
-    private Hashtable ids = new Hashtable(DEFAULT_SIZE);
+    private Map<String, List<BigDecimal>> ids
+            = new Hashtable<String, List<BigDecimal>>(DEFAULT_SIZE);
 
     /**
      * The quantity of ids to grab for each table.
@@ -129,7 +130,8 @@ public class IDBroker implements Runnabl
      * Key: String table name.
      * Value: Integer quantity.
      */
-    private Hashtable quantityStore = new Hashtable(DEFAULT_SIZE);
+    private Map<String, BigDecimal> quantityStore
+        = new Hashtable<String, BigDecimal>(DEFAULT_SIZE);
 
     /**
      * The last time this IDBroker queried the database for ids.
@@ -137,7 +139,8 @@ public class IDBroker implements Runnabl
      * Key: String table name.
      * Value: Date of last id request.
      */
-    private Hashtable lastQueryTime = new Hashtable(DEFAULT_SIZE);
+    private Map<String, java.util.Date> lastQueryTime
+            = new Hashtable<String, java.util.Date>(DEFAULT_SIZE);
 
     /**
      * Amount of time for the thread to sleep
@@ -444,7 +447,7 @@ public class IDBroker implements Runnabl
         // would be preferrable to avoid the synchronization on the
         // method
 
-        List availableIds = (List) ids.get(tableName);
+        List<BigDecimal> availableIds = ids.get(tableName);
 
         if (availableIds == null || availableIds.size() < numOfIdsToReturn)
         {
@@ -457,7 +460,7 @@ public class IDBroker implements Runnabl
                 log.debug("Forced id retrieval - " + availableIds.size());
             }
             storeIDs(tableName, true, connection);
-            availableIds = (List) ids.get(tableName);
+            availableIds = ids.get(tableName);
         }
 
         int size = availableIds.size() < numOfIdsToReturn
@@ -472,7 +475,7 @@ public class IDBroker implements Runnabl
         //        {
         for (int i = size - 1; i >= 0; i--)
         {
-            results[i] = (BigDecimal) availableIds.get(i);
+            results[i] = availableIds.get(i);
             availableIds.remove(i);
         }
         //        }
@@ -544,16 +547,14 @@ public class IDBroker implements Runnabl
             }
 
             // logger.info("IDBroker thread checking for more keys.");
-            Iterator it = ids.keySet().iterator();
-            while (it.hasNext())
+            for (String tableName : ids.keySet())
             {
-                String tableName = (String) it.next();
                 if (log.isDebugEnabled())
                 {
                     log.debug("IDBroker thread checking for more keys "
                             + "on table: " + tableName);
                 }
-                List availableIds = (List) ids.get(tableName);
+                List<BigDecimal> availableIds = ids.get(tableName);
                 int quantity = getQuantity(tableName, null).intValue();
                 if (quantity > availableIds.size())
                 {
@@ -706,10 +707,10 @@ public class IDBroker implements Runnabl
             throw e;
         }
 
-        List availableIds = (List) ids.get(tableName);
+        List<BigDecimal> availableIds = ids.get(tableName);
         if (availableIds == null)
         {
-            availableIds = new ArrayList();
+            availableIds = new ArrayList<BigDecimal>();
             ids.put(tableName, availableIds);
         }
 
@@ -744,7 +745,7 @@ public class IDBroker implements Runnabl
         // If prefetch is turned off we simply return 1
         if (!configuration.getBoolean(DB_IDBROKER_PREFETCH, true))
         {
-            quantity = new BigDecimal((double)1);
+            quantity = new BigDecimal((double) 1);
         }
         // Initialize quantity, if necessary.
         else if (quantityStore.containsKey(tableName))
@@ -772,7 +773,7 @@ public class IDBroker implements Runnabl
             }
             catch (Exception e)
             {
-                quantity = new BigDecimal((double)10);
+                quantity = new BigDecimal((double) 10);
             }
             finally
             {

Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/oid/IDGeneratorFactory.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/oid/IDGeneratorFactory.java?rev=1003834&r1=1003833&r2=1003834&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/oid/IDGeneratorFactory.java (original)
+++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/oid/IDGeneratorFactory.java Sat Oct  2 16:51:32 2010
@@ -29,7 +29,7 @@ import org.apache.torque.adapter.IDMetho
  * @author <a href="mailto:dlr@collab.net">Daniel Rall</a>
  * @version $Id$
  */
-public class IDGeneratorFactory
+public final class IDGeneratorFactory
 {
     /**
      * Private constructor to prevent initialisation.

Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/om/ComboKey.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/om/ComboKey.java?rev=1003834&r1=1003833&r2=1003834&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/om/ComboKey.java (original)
+++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/om/ComboKey.java Sat Oct  2 16:51:32 2010
@@ -20,6 +20,8 @@ package org.apache.torque.om;
  */
 
 import java.util.ArrayList;
+import java.util.List;
+
 import org.apache.commons.lang.ObjectUtils;
 
 /**
@@ -100,7 +102,7 @@ public class ComboKey extends ObjectKey
     {
         int startPtr = 0;
         int indexOfSep = keys.indexOf(SEPARATOR);
-        ArrayList tmpKeys = new ArrayList();
+        List<SimpleKey> tmpKeys = new ArrayList<SimpleKey>();
         while (indexOfSep != -1)
         {
             if (indexOfSep == startPtr)
@@ -143,7 +145,7 @@ public class ComboKey extends ObjectKey
         this.key = new SimpleKey[tmpKeys.size()];
         for (int i = 0; i < this.key.length; i++)
         {
-            this.key[i] = (SimpleKey) tmpKeys.get(i);
+            this.key[i] = tmpKeys.get(i);
         }
     }
 

Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/om/NumberKey.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/om/NumberKey.java?rev=1003834&r1=1003833&r2=1003834&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/om/NumberKey.java (original)
+++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/om/NumberKey.java Sat Oct  2 16:51:32 2010
@@ -139,7 +139,7 @@ public class NumberKey extends SimpleKey
      * @param key the key value
      * @throws NumberFormatException if key is not a valid number
      */
-    public void setValue(String key) throws NumberFormatException
+    public void setValue(String key)
     {
         this.key = new BigDecimal(key);
     }

Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/om/ObjectKey.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/om/ObjectKey.java?rev=1003834&r1=1003833&r2=1003834&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/om/ObjectKey.java (original)
+++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/om/ObjectKey.java Sat Oct  2 16:51:32 2010
@@ -31,7 +31,7 @@ import org.apache.torque.TorqueException
  * @author <a href="mailto:jmcnally@apache.org">John McNally</a>
  * @version $Id$
  */
-public abstract class ObjectKey implements Serializable, Comparable
+public abstract class ObjectKey implements Serializable, Comparable<Object>
 {
     /**
      * The underlying key value.

Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/BasePeer.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/BasePeer.java?rev=1003834&r1=1003833&r2=1003834&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/BasePeer.java (original)
+++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/BasePeer.java Sat Oct  2 16:51:32 2010
@@ -387,7 +387,7 @@ public abstract class BasePeer
         // data that is referenced through foreign keys will also be
         // deleted.
         SQLBuilder.TableCallback tc = new SQLBuilder.TableCallback() {
-                public void process (Set tables, String key, Criteria crit)
+                public void process (Set<String> tables, String key, Criteria crit)
                 {
                     if (crit.isCascade())
                     {
@@ -416,14 +416,14 @@ public abstract class BasePeer
                 }
             };
 
-        Set tables;
+        Set<String> tables;
         if (tableName == null)
         {
             tables = SQLBuilder.getTableSet(criteria, tc);
         }
         else
         {
-            tables = new HashSet(1);
+            tables = new HashSet<String>(1);
             tables.add(tableName);
         }
 
@@ -523,7 +523,7 @@ public abstract class BasePeer
         // Get the table name and method for determining the primary
         // key value.
         String table = null;
-        Iterator keys = criteria.keySet().iterator();
+        Iterator<?> keys = criteria.keySet().iterator();
         if (keys.hasNext())
         {
             table = criteria.getTableName((String) keys.next());
@@ -734,7 +734,7 @@ public abstract class BasePeer
         throws TorqueException
     {
         return SQLBuilder.buildQueryClause(criteria, null, new SQLBuilder.QueryCallback() {
-                public String process(Criteria.Criterion criterion, List params)
+                public String process(Criteria.Criterion criterion, List<Object> params)
                 {
                     return criterion.toString();
                 }
@@ -749,17 +749,19 @@ public abstract class BasePeer
      * @throws TorqueException Any exceptions caught during processing will be
      *         rethrown wrapped into a TorqueException.
      */
-    public static List doSelect(Criteria criteria) throws TorqueException
+    public static List<Record> doSelectVillageRecords(
+                Criteria criteria)
+            throws TorqueException
     {
         Connection con = null;
-        List results = null;
+        List<Record> results = null;
 
         try
         {
             con = Transaction.beginOptional(
                     criteria.getDbName(),
                     criteria.isUseTransaction());
-            results = doSelect(criteria, con);
+            results = doSelectVillageRecords(criteria, con);
             Transaction.commit(con);
         }
         catch (TorqueException e)
@@ -779,8 +781,9 @@ public abstract class BasePeer
      * @throws TorqueException Any exceptions caught during processing will be
      *         rethrown wrapped into a TorqueException.
      */
-    public static List doSelect(Criteria criteria, Connection con)
-        throws TorqueException
+    public static List<Record> doSelectVillageRecords(
+                Criteria criteria, Connection con)
+            throws TorqueException
     {
         Query query = createQuery(criteria);
         DB dbadapter = Torque.getDB(criteria.getDbName());
@@ -803,7 +806,7 @@ public abstract class BasePeer
      * @throws TorqueException Any exceptions caught during processing will be
      *         rethrown wrapped into a TorqueException.
      */
-    public static List executeQuery(String queryString) throws TorqueException
+    public static List<Record> executeQuery(String queryString) throws TorqueException
     {
         return executeQuery(queryString, Torque.getDefaultDB(), false);
     }
@@ -819,7 +822,7 @@ public abstract class BasePeer
      * @throws TorqueException Any exceptions caught during processing will be
      *         rethrown wrapped into a TorqueException.
      */
-    public static List executeQuery(String queryString, String dbName)
+    public static List<Record> executeQuery(String queryString, String dbName)
         throws TorqueException
     {
         return executeQuery(queryString, dbName, false);
@@ -836,7 +839,7 @@ public abstract class BasePeer
      * @throws TorqueException Any exceptions caught during processing will be
      *         rethrown wrapped into a TorqueException.
      */
-    public static List executeQuery(
+    public static List<Record> executeQuery(
         String queryString,
         String dbName,
         boolean singleRecord)
@@ -856,7 +859,7 @@ public abstract class BasePeer
      * @throws TorqueException Any exceptions caught during processing will be
      *         rethrown wrapped into a TorqueException.
      */
-    public static List executeQuery(
+    public static List<Record> executeQuery(
         String queryString,
         boolean singleRecord,
         Connection con)
@@ -878,7 +881,7 @@ public abstract class BasePeer
      * @throws TorqueException Any exceptions caught during processing will be
      *         rethrown wrapped into a TorqueException.
      */
-    public static List executeQuery(
+    public static List<Record> executeQuery(
         String queryString,
         int start,
         int numberOfResults,
@@ -887,7 +890,7 @@ public abstract class BasePeer
         throws TorqueException
     {
         Connection con = null;
-        List results = null;
+        List<Record> results = null;
         try
         {
             con = Torque.getConnection(dbName);
@@ -919,7 +922,7 @@ public abstract class BasePeer
      * @throws TorqueException Any exceptions caught during processing will be
      *         rethrown wrapped into a TorqueException.
      */
-    public static List executeQuery(
+    public static List<Record> executeQuery(
         String queryString,
         int start,
         int numberOfResults,
@@ -928,7 +931,7 @@ public abstract class BasePeer
         throws TorqueException
     {
         QueryDataSet qds = null;
-        List results = Collections.EMPTY_LIST;
+        List<Record> results = Collections.emptyList();
         try
         {
             // execute the query
@@ -967,7 +970,7 @@ public abstract class BasePeer
      * @throws TorqueException Any exceptions caught during processing will be
      *         rethrown wrapped into a TorqueException.
      */
-    public static List getSelectResults(QueryDataSet qds)
+    public static List<Record> getSelectResults(QueryDataSet qds)
         throws TorqueException
     {
         return getSelectResults(qds, 0, -1, false);
@@ -984,7 +987,7 @@ public abstract class BasePeer
      * @throws TorqueException Any exceptions caught during processing will be
      *         rethrown wrapped into a TorqueException.
      */
-    public static List getSelectResults(QueryDataSet qds, boolean singleRecord)
+    public static List<Record> getSelectResults(QueryDataSet qds, boolean singleRecord)
         throws TorqueException
     {
         return getSelectResults(qds, 0, -1, singleRecord);
@@ -1003,13 +1006,13 @@ public abstract class BasePeer
      * @throws TorqueException Any exceptions caught during processing will be
      *         rethrown wrapped into a TorqueException.
      */
-    public static List getSelectResults(
+    public static List<Record> getSelectResults(
         QueryDataSet qds,
         int numberOfResults,
         boolean singleRecord)
         throws TorqueException
     {
-        List results = null;
+        List<Record> results = null;
         if (numberOfResults != 0)
         {
             results = getSelectResults(qds, 0, numberOfResults, singleRecord);
@@ -1033,24 +1036,24 @@ public abstract class BasePeer
      * @return A <code>List</code> of <code>Record</code> objects.
      * @exception TorqueException If any <code>Exception</code> occurs.
      */
-    public static List getSelectResults(
+    public static List<Record> getSelectResults(
         QueryDataSet qds,
         int start,
         int numberOfResults,
         boolean singleRecord)
         throws TorqueException
     {
-        List results = null;
+        List<Record> results = null;
         try
         {
             if (numberOfResults < 0)
             {
-                results = new ArrayList();
+                results = new ArrayList<Record>();
                 qds.fetchRecords();
             }
             else
             {
-                results = new ArrayList(numberOfResults);
+                results = new ArrayList<Record>(numberOfResults);
                 qds.fetchRecords(start, numberOfResults);
             }
 
@@ -1259,7 +1262,7 @@ public abstract class BasePeer
         Connection con)
         throws TorqueException
     {
-        Set tables = SQLBuilder.getTableSet(criteria, null);
+        Set<String> tables = SQLBuilder.getTableSet(criteria, null);
 
         try
         {
@@ -1406,13 +1409,13 @@ public abstract class BasePeer
      * @return a List of Record objects.
      * @throws TorqueException Error performing database query.
      */
-    public static List doPSSelect(Criteria criteria, Connection con)
+    public static List<Record> doPSSelect(Criteria criteria, Connection con)
         throws TorqueException
     {
-        List v = null;
+        List<Record> v = null;
 
         StringBuffer qry = new StringBuffer();
-        List params = new ArrayList(criteria.size());
+        List<Object> params = new ArrayList<Object>(criteria.size());
 
         createPreparedStatement(criteria, qry, params);
 
@@ -1487,10 +1490,10 @@ public abstract class BasePeer
      * @throws TorqueException Any exceptions caught during processing will be
      *         rethrown wrapped into a TorqueException.
      */
-    public static List doPSSelect(Criteria criteria) throws TorqueException
+    public static List<Record> doPSSelect(Criteria criteria) throws TorqueException
     {
         Connection con = Torque.getConnection(criteria.getDbName());
-        List v = null;
+        List<Record> v = null;
 
         try
         {
@@ -1516,11 +1519,11 @@ public abstract class BasePeer
     public static void createPreparedStatement(
         Criteria criteria,
         StringBuffer queryString,
-        List params)
+        List<Object> params)
         throws TorqueException
     {
         Query query = SQLBuilder.buildQueryClause(criteria, params, new SQLBuilder.QueryCallback() {
-                public String process(Criteria.Criterion criterion, List params)
+                public String process(Criteria.Criterion criterion, List<Object> params)
                 {
                     StringBuffer sb = new StringBuffer();
                     criterion.appendPsTo(sb, params);
@@ -1553,7 +1556,7 @@ public abstract class BasePeer
             TableMap defaultTableMap)
         throws TorqueException
     {
-        Iterator keyIt = criteria.keySet().iterator();
+        Iterator<?> keyIt = criteria.keySet().iterator();
         while (keyIt.hasNext())
         {
             String key = (String) keyIt.next();
@@ -1582,10 +1585,10 @@ public abstract class BasePeer
                 if (tableMap == null)
                 {
                     // try aliases
-                    Map aliases = criteria.getAliases();
+                    Map<String, String> aliases = criteria.getAliases();
                     if (aliases.get(tableName) != null)
                     {
-                        tableName = (String) aliases.get(tableName);
+                        tableName = aliases.get(tableName);
                         tableMap = databaseMap.getTable(tableName);
                     }
                 }
@@ -1665,7 +1668,7 @@ public abstract class BasePeer
      *
      * @throws Exception An Error occured (should be wrapped into TorqueException)
      */
-    private static void processTables(Criteria crit, Set tables, Connection con, ProcessCallback pc)
+    private static void processTables(Criteria crit, Set<String> tables, Connection con, ProcessCallback pc)
             throws Exception
     {
         String dbName = crit.getDbName();
@@ -1673,11 +1676,10 @@ public abstract class BasePeer
         DatabaseMap dbMap = Torque.getDatabaseMap(dbName);
 
         // create the statements for the tables
-        for (Iterator it = tables.iterator(); it.hasNext();)
+        for (String table : tables)
         {
-            String table = (String) it.next();
             KeyDef kd = new KeyDef();
-            Set whereClause = new HashSet();
+            Set<String> whereClause = new HashSet<String>();
 
             ColumnMap[] columnMaps = dbMap.getTable(table).getColumns();
 

Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/CountHelper.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/CountHelper.java?rev=1003834&r1=1003833&r2=1003834&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/CountHelper.java (original)
+++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/CountHelper.java Sat Oct  2 16:51:32 2010
@@ -36,6 +36,9 @@ import org.apache.torque.TorqueException
 import com.workingdogs.village.DataSetException;
 import com.workingdogs.village.Record;
 
+/**
+ * Counts entries matching a criteria.
+ */
 public class CountHelper
 {
     /**
@@ -105,8 +108,8 @@ public class CountHelper
         c.getOrderByColumns().clear();
         c.getGroupByColumns().clear();
 
-        UniqueList criteriaSelectModifiers;
-        criteriaSelectModifiers = c.getSelectModifiers();
+        UniqueList<String> criteriaSelectModifiers
+            = c.getSelectModifiers();
 
         boolean distinct = false;
         if (criteriaSelectModifiers != null
@@ -124,14 +127,14 @@ public class CountHelper
 
         c.addSelectColumn(countStr.toString());
 
-        List result;
+        List<Record> result;
         if (conn == null)
         {
-            result = BasePeer.doSelect(c);
+            result = BasePeer.doSelectVillageRecords(c);
         }
         else
         {
-            result = BasePeer.doSelect(c, conn);
+            result = BasePeer.doSelectVillageRecords(c, conn);
         }
 
         Record record = (Record) result.get(0);

Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/Criteria.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/Criteria.java?rev=1003834&r1=1003833&r2=1003834&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/Criteria.java (original)
+++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/Criteria.java Sat Oct  2 16:51:32 2010
@@ -31,11 +31,10 @@ import java.util.GregorianCalendar;
 import java.util.HashMap;
 import java.util.Hashtable;
 import java.util.Iterator;
+import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
 
-import org.apache.commons.collections.OrderedMap;
-import org.apache.commons.collections.map.ListOrderedMap;
 import org.apache.commons.lang.ObjectUtils;
 import org.apache.commons.lang.StringUtils;
 import org.apache.commons.logging.Log;
@@ -154,13 +153,27 @@ public class Criteria extends Hashtable
     private boolean ignoreCase = false;
     private boolean singleRecord = false;
     private boolean cascade = false;
-    private UniqueList selectModifiers = new UniqueList();
-    private UniqueList selectColumns = new UniqueList();
-    private UniqueList orderByColumns = new UniqueList();
-    private UniqueList groupByColumns = new UniqueList();
+
+    /** List of modifiers like DISTICT. */
+    private UniqueList<String> selectModifiers = new UniqueList<String>();
+
+    /** List of all columns to select. */
+    private UniqueList<String> selectColumns = new UniqueList<String>();
+
+    /** All "order by" clauses, containg the order ASC or DESC. */
+    private UniqueList<String> orderByColumns = new UniqueList<String>();
+
+    /** The names of columns to add to a groupoBy clause */
+    private UniqueList<String> groupByColumns = new UniqueList<String>();
+
     private Criterion having = null;
-    private OrderedMap asColumns = ListOrderedMap.decorate(new HashMap());
-    private transient List joins = new ArrayList(3);
+
+    /** Maps column alias names to the real column names. */
+    private Map<String, String> asColumns
+            = new LinkedHashMap<String, String>();
+
+    /** Contains all joins. */
+    private transient List<Join> joins = new ArrayList(3);
 
     /** The name of the database. */
     private String dbName;
@@ -177,7 +190,11 @@ public class Criteria extends Hashtable
     /** To start the results at a row other than the first one. */
     private int offset = 0;
 
-    private HashMap aliases = new HashMap(8);
+    /**
+     * Aliases for table names. The key of the map is the alias,
+     * and the value is the real name of the table.
+     */
+    private Map<String, String> aliases = new HashMap<String, String>();
 
     private boolean useTransaction = false;
 
@@ -281,7 +298,7 @@ public class Criteria extends Hashtable
      * @return A Map which map the column alias names
      * to the alias clauses.
      */
-    public Map getAsColumns()
+    public Map<String, String> getAsColumns()
     {
         return asColumns;
     }
@@ -291,7 +308,7 @@ public class Criteria extends Hashtable
      *
      * @return A Map which maps the table alias names to the actual table names.
      */
-    public Map getAliases()
+    public Map<String, String> getAliases()
     {
         return aliases;
     }
@@ -316,7 +333,7 @@ public class Criteria extends Hashtable
      */
     public String getTableForAlias(String alias)
     {
-        return (String) aliases.get(alias);
+        return aliases.get(alias);
     }
 
     /**
@@ -774,9 +791,9 @@ public class Criteria extends Hashtable
      * @param name A String with the name of the key.
      * @return A List with the value of object at key.
      */
-    public List getList(String name)
+    public List<Object> getList(String name)
     {
-        return (List) getCriterion(name).getValue();
+        return (List<Object>) getCriterion(name).getValue();
     }
 
     /**
@@ -786,7 +803,7 @@ public class Criteria extends Hashtable
      * @param column String name of column.
      * @return A List with the value of object at key.
      */
-    public List getList(String table, String column)
+    public List<Object> getList(String table, String column)
     {
         return getList(
                 new StringBuffer(table.length() + column.length() + 1)
@@ -1356,7 +1373,7 @@ public class Criteria extends Hashtable
      * @return a List which contains objects of type Join.
      *         If the criteria does not contains any joins, the list is empty
      */
-    public List getJoins()
+    public List<Join> getJoins()
     {
         return joins;
     }
@@ -1448,7 +1465,7 @@ public class Criteria extends Hashtable
      * @param values A List with the allowed values.
      * @return A modified Criteria object.
      */
-    public Criteria addIn(String column, List values)
+    public Criteria addIn(String column, List<?> values)
     {
         add(column, (Object) values, Criteria.IN);
         return this;
@@ -1519,7 +1536,7 @@ public class Criteria extends Hashtable
      * @param values A List with the disallowed values.
      * @return A modified Criteria object.
      */
-    public Criteria addNotIn(String column, List values)
+    public Criteria addNotIn(String column, List<?> values)
     {
         add(column, (Object) values, Criteria.NOT_IN);
         return this;
@@ -1673,10 +1690,9 @@ public class Criteria extends Hashtable
     /**
      * Get select columns.
      *
-     * @return An StringStack with the name of the select
-     * columns.
+     * @return An List with the names of the select columns.
      */
-    public UniqueList getSelectColumns()
+    public UniqueList<String> getSelectColumns()
     {
         return selectColumns;
     }
@@ -1686,7 +1702,7 @@ public class Criteria extends Hashtable
      *
      * @return An UniqueList with the select modifiers.
      */
-    public UniqueList getSelectModifiers()
+    public UniqueList<String> getSelectModifiers()
     {
         return selectModifiers;
     }
@@ -1732,7 +1748,7 @@ public class Criteria extends Hashtable
      *
      * @return An UniqueList with the name of the order columns.
      */
-    public UniqueList getOrderByColumns()
+    public UniqueList<String> getOrderByColumns()
     {
         return orderByColumns;
     }
@@ -1742,7 +1758,7 @@ public class Criteria extends Hashtable
      *
      * @return An UniqueList with the name of the groupBy clause.
      */
-    public UniqueList getGroupByColumns()
+    public UniqueList<String> getGroupByColumns()
     {
         return groupByColumns;
     }
@@ -1781,7 +1797,7 @@ public class Criteria extends Hashtable
     public String toString()
     {
         StringBuffer sb = new StringBuffer("Criteria:: ");
-        Iterator it = keySet().iterator();
+        Iterator<?> it = keySet().iterator();
         while (it.hasNext())
         {
             String key = (String) it.next();
@@ -1835,7 +1851,7 @@ public class Criteria extends Hashtable
                 )
             {
                 isEquiv = true;
-                for (Iterator it = criteria.keySet().iterator(); it.hasNext();)
+                for (Iterator<?> it = criteria.keySet().iterator(); it.hasNext();)
                 {
                     String key = (String) it.next();
                     if (this.containsKey(key))
@@ -2395,7 +2411,7 @@ public class Criteria extends Hashtable
      * @param values A List with the allowed values.
      * @return A modified Criteria object.
      */
-    public Criteria andIn(String column, List values)
+    public Criteria andIn(String column, List<?> values)
     {
         and(column, (Object) values, Criteria.IN);
         return this;
@@ -2466,7 +2482,7 @@ public class Criteria extends Hashtable
      * @param values A List with the disallowed values.
      * @return A modified Criteria object.
      */
-    public Criteria andNotIn(String column, List values)
+    public Criteria andNotIn(String column, List<?> values)
     {
         and(column, (Object) values, Criteria.NOT_IN);
         return this;
@@ -2960,7 +2976,7 @@ public class Criteria extends Hashtable
      * @param values A List with the allowed values.
      * @return A modified Criteria object.
      */
-    public Criteria orIn(String column, List values)
+    public Criteria orIn(String column, List<?> values)
     {
         or(column, (Object) values, Criteria.IN);
         return this;
@@ -3031,7 +3047,7 @@ public class Criteria extends Hashtable
      * @param values A List with the disallowed values.
      * @return A modified Criteria object.
      */
-    public Criteria orNotIn(String column, List values)
+    public Criteria orNotIn(String column, List<?> values)
     {
         or(column, (Object) values, Criteria.NOT_IN);
         return this;
@@ -3048,16 +3064,16 @@ public class Criteria extends Hashtable
         s.defaultWriteObject();
 
         // Joins need to be serialized manually.
-        ArrayList serializableJoins = null;
+        ArrayList<List<Object>> serializableJoins = null;
         if (!joins.isEmpty())
         {
-            serializableJoins = new ArrayList(joins.size());
+            serializableJoins = new ArrayList<List<Object>>(joins.size());
 
-            for (Iterator jonisIter = joins.iterator(); jonisIter.hasNext();)
+            for (Iterator<Join> joinsIter = joins.iterator(); joinsIter.hasNext();)
             {
-                Join join = (Join) jonisIter.next();
+                Join join = joinsIter.next();
 
-                ArrayList joinContent = new ArrayList(3);
+                ArrayList<Object> joinContent = new ArrayList<Object>(3);
                 joinContent.add(join.getLeftColumn());
                 joinContent.add(join.getRightColumn());
                 joinContent.add(join.getJoinType());
@@ -3083,7 +3099,7 @@ public class Criteria extends Hashtable
 
         // Criteria.put() differs somewhat from Hashtable.put().
         // This necessitates some corrective behavior upon deserialization.
-        for (Iterator iter = keySet().iterator(); iter.hasNext();)
+        for (Iterator<?> iter = keySet().iterator(); iter.hasNext();)
         {
             Object key = iter.next();
             Object value = get(key);
@@ -3094,14 +3110,15 @@ public class Criteria extends Hashtable
         }
 
         // Joins need to be deserialized manually.
-        this.joins = new ArrayList(3);
+        this.joins = new ArrayList<Join>(3);
 
-        ArrayList joins = (ArrayList) s.readObject();
+        ArrayList<List<Object>> joins
+            = (ArrayList<List<Object>>) s.readObject();
         if (joins != null)
         {
             for (int i = 0; i < joins.size(); i++)
             {
-                ArrayList joinContent = (ArrayList) joins.get(i);
+                List<Object> joinContent = joins.get(i);
 
                 String leftColumn = (String) joinContent.get(0);
                 String rightColumn = (String) joinContent.get(1);
@@ -3149,10 +3166,12 @@ public class Criteria extends Hashtable
         private DB db;
 
         /**
-         * other connected criteria and their conjunctions.
+         * other connected criteria.
          */
-        private List clauses = new ArrayList();
-        private List conjunctions = new ArrayList();
+        private List<Criterion> clauses = new ArrayList<Criterion>();
+
+        /** The operators (AND, OR...) how the other Criteria are connected. */
+        private List<String> conjunctions = new ArrayList<String>();
 
         /**
          * Creates a new instance, initializing a couple members.
@@ -3331,7 +3350,7 @@ public class Criteria extends Hashtable
 
             for (int i = 0; i < this.clauses.size(); i++)
             {
-                ((Criterion) (clauses.get(i))).setDB(v);
+                ((clauses.get(i))).setDB(v);
             }
         }
 
@@ -3360,7 +3379,7 @@ public class Criteria extends Hashtable
         /**
          *  get the list of clauses in this Criterion
          */
-        private List getClauses()
+        private List<Criterion> getClauses()
         {
             return clauses;
         }
@@ -3368,7 +3387,7 @@ public class Criteria extends Hashtable
         /**
          *  get the list of conjunctions in this Criterion
          */
-        private List getConjunctions()
+        private List<String> getConjunctions()
         {
             return conjunctions;
         }
@@ -3440,7 +3459,7 @@ public class Criteria extends Hashtable
             for (int i = 0; i < this.clauses.size(); i++)
             {
                 sb.append(this.conjunctions.get(i));
-                clause = (Criterion) (this.clauses.get(i));
+                clause = this.clauses.get(i);
                 clause.appendTo(sb);
                 sb.append(')');
             }
@@ -3454,7 +3473,7 @@ public class Criteria extends Hashtable
          * @param params A list to which Prepared Statement parameters
          * will be appended
          */
-        public void appendPsTo(StringBuffer sb, List params)
+        public void appendPsTo(StringBuffer sb, List<Object> params)
         {
             if (column == null || value == null)
             {
@@ -3495,11 +3514,11 @@ public class Criteria extends Hashtable
                     sb.append(field)
                             .append(comparison);
 
-                    UniqueList inClause = new UniqueList();
+                    UniqueList<String> inClause = new UniqueList<String>();
 
                     if (value instanceof List)
                     {
-                        value = ((List) value).toArray (new Object[0]);
+                        value = ((List<?>) value).toArray (new Object[0]);
                     }
 
                     for (int i = 0; i < Array.getLength(value); i++)
@@ -3555,7 +3574,7 @@ public class Criteria extends Hashtable
             for (int i = 0; i < this.clauses.size(); i++)
             {
                 sb.append(this.conjunctions.get(i));
-                Criterion clause = (Criterion) (this.clauses.get(i));
+                Criterion clause = this.clauses.get(i);
                 clause.appendPsTo(sb, params);
                 sb.append(')');
             }
@@ -3635,10 +3654,10 @@ public class Criteria extends Hashtable
             isEquiv &= this.clauses.size() == crit.getClauses().size();
             for (int i = 0; i < this.clauses.size(); i++)
             {
-                isEquiv &=  ((String) (conjunctions.get(i)))
+                isEquiv &=  conjunctions.get(i)
                         .equals((String) (crit.getConjunctions().get(i)));
-                isEquiv &=  ((Criterion) (clauses.get(i)))
-                        .equals((Criterion) (crit.getClauses().get(i)));
+                isEquiv &=  clauses.get(i)
+                        .equals(crit.getClauses().get(i));
             }
 
             return isEquiv;
@@ -3663,20 +3682,20 @@ public class Criteria extends Hashtable
 
             for (int i = 0; i < this.clauses.size(); i++)
             {
-                h ^= ((Criterion) (clauses.get(i))).hashCode();
+                h ^= (clauses.get(i)).hashCode();
             }
 
             return h;
         }
 
         /**
-         * get all tables from nested criterion objects
+         * Get the name of all tables from nested criterion objects
          *
          * @return the list of tables
          */
-        public List getAllTables()
+        public List<String> getAllTables()
         {
-            UniqueList tables = new UniqueList();
+            UniqueList<String> tables = new UniqueList<String>();
             addCriterionTable(this, tables);
             return tables;
         }
@@ -3685,7 +3704,7 @@ public class Criteria extends Hashtable
          * method supporting recursion through all criterions to give
          * us a StringStack of tables from each criterion
          */
-        private void addCriterionTable(Criterion c, UniqueList s)
+        private void addCriterionTable(Criterion c, UniqueList<String> s)
         {
             if (c != null)
             {
@@ -3703,7 +3722,7 @@ public class Criteria extends Hashtable
          */
         public Criterion[] getAttachedCriterion()
         {
-            ArrayList crits = new ArrayList();
+            ArrayList<Criterion> crits = new ArrayList<Criterion>();
             traverseCriterion(this, crits);
             Criterion[] crita = new Criterion[crits.size()];
             for (int i = 0; i < crits.size(); i++)
@@ -3718,14 +3737,14 @@ public class Criteria extends Hashtable
          * method supporting recursion through all criterions to give
          * us an ArrayList of them
          */
-        private void traverseCriterion(Criterion c, ArrayList a)
+        private void traverseCriterion(Criterion c, List<Criterion> a)
         {
             if (c != null)
             {
                 a.add(c);
                 for (int i = 0; i < c.getClauses().size(); i++)
                 {
-                    traverseCriterion((Criterion) (c.getClauses().get(i)), a);
+                    traverseCriterion(c.getClauses().get(i), a);
                 }
             }
         }

Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/JoinBuilder.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/JoinBuilder.java?rev=1003834&r1=1003833&r2=1003834&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/JoinBuilder.java (original)
+++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/JoinBuilder.java Sat Oct  2 16:51:32 2010
@@ -59,15 +59,15 @@ public final class JoinBuilder
             final Query query)
             throws TorqueException
     {
-        List criteriaJoins = criteria.getJoins();
+        List<Criteria.Join> criteriaJoins = criteria.getJoins();
 
         if (criteriaJoins.isEmpty())
         {
             return;
         }
 
-        UniqueList queryFromClause = query.getFromClause();
-        UniqueList queryWhereClause = query.getWhereClause();
+        UniqueList<Query.FromElement> queryFromClause = query.getFromClause();
+        UniqueList<String> queryWhereClause = query.getWhereClause();
 
         for (int i = 0; i < criteriaJoins.size(); i++)
         {

Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/LargeSelect.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/LargeSelect.java?rev=1003834&r1=1003833&r2=1003834&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/LargeSelect.java (original)
+++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/LargeSelect.java Sat Oct  2 16:51:32 2010
@@ -29,6 +29,7 @@ import java.util.ArrayList;
 import java.util.Hashtable;
 import java.util.Iterator;
 import java.util.List;
+import java.util.Map;
 import java.util.Set;
 
 import org.apache.commons.logging.Log;
@@ -38,6 +39,7 @@ import org.apache.torque.TorqueException
 
 import com.workingdogs.village.DataSetException;
 import com.workingdogs.village.QueryDataSet;
+import com.workingdogs.village.Record;
 
 /**
  * This class can be used to retrieve a large result set from a database query.
@@ -158,7 +160,7 @@ public class LargeSelect implements Runn
     private String dbName;
 
     /** The memory store of records. */
-    private transient List results = null;
+    private transient List<Record> results = null;
 
     /** The thread that executes the query. */
     private transient Thread thread = null;
@@ -240,7 +242,7 @@ public class LargeSelect implements Runn
     private static final int QUERY_STOP_SLEEP_TIME = 100;
 
     /** A place to store search parameters that relate to this query. */
-    private Hashtable params = null;
+    private Map<String, String> params = null;
 
     /** Logging */
     private static Log log = LogFactory.getLog(LargeSelect.class);
@@ -362,7 +364,7 @@ public class LargeSelect implements Runn
             // Add the select columns if necessary.
             if (criteria.getSelectColumns().size() == 0)
             {
-                Class[] argTypes = { Criteria.class };
+                Class<?>[] argTypes = { Criteria.class };
                 Method selectColumnAdder =
                     returnBuilderClass.getMethod("addSelectColumns", argTypes);
                 Object[] theArgs = { criteria };
@@ -393,7 +395,7 @@ public class LargeSelect implements Runn
     {
         if (null == populateObjectsMethod)
         {
-            Class[] argTypes = { List.class };
+            Class<?>[] argTypes = { List.class };
             populateObjectsMethod
                     = returnBuilderClass.getMethod("populateObjects", argTypes);
         }
@@ -722,7 +724,7 @@ public class LargeSelect implements Runn
         try
         {
             // Add 1 to memory limit to check if the query ends on a page break.
-            results = new ArrayList(memoryLimit + 1);
+            results = new ArrayList<Record>(memoryLimit + 1);
 
             // Use the criteria to limit the rows that are retrieved to the
             // block of records that fit in the predefined memoryLimit.
@@ -788,7 +790,7 @@ public class LargeSelect implements Runn
                             + size + ", false)");
                 }
 
-                List tempResults
+                List<Record> tempResults
                         = BasePeer.getSelectResults(qds, size, false);
 
                 int startIndex = dbSupportsNativeOffset ? 0 : blockBegin;
@@ -1268,7 +1270,7 @@ public class LargeSelect implements Runn
         {
             return defaultValue;
         }
-        String value = (String) params.get(name);
+        String value = params.get(name);
         return null == value ? defaultValue : value;
     }
 
@@ -1291,7 +1293,7 @@ public class LargeSelect implements Runn
             {
                 if (null == params)
                 {
-                    params = new Hashtable();
+                    params = new Hashtable<String, String>();
                 }
                 params.put(name, value);
             }
@@ -1349,11 +1351,11 @@ public class LargeSelect implements Runn
         }
         else
         {
-            Set keys = params.keySet();
-            for (Iterator iter = keys.iterator(); iter.hasNext();)
+            Set<String> keys = params.keySet();
+            for (Iterator<String> iter = keys.iterator(); iter.hasNext();)
             {
-                String key = (String) iter.next();
-                String val = (String) params.get(key);
+                String key = iter.next();
+                String val = params.get(key);
                 result.append("\n ").append(key).append(": ").append(val);
             }
         }

Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/Query.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/Query.java?rev=1003834&r1=1003833&r2=1003834&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/Query.java (original)
+++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/Query.java Sat Oct  2 16:51:32 2010
@@ -49,12 +49,12 @@ public class Query
     private static final String OFFSET = " OFFSET ";
     private static final String ROWCOUNT = " SET ROWCOUNT ";
 
-    private UniqueList selectModifiers = new UniqueList();
-    private UniqueList selectColumns = new UniqueList();
-    private UniqueList fromTables = new UniqueList();
-    private UniqueList whereCriteria = new UniqueList();
-    private UniqueList orderByColumns = new UniqueList();
-    private UniqueList groupByColumns = new UniqueList();
+    private UniqueList<String> selectModifiers = new UniqueList<String>();
+    private UniqueList<String> selectColumns = new UniqueList<String>();
+    private UniqueList<FromElement> fromTables = new UniqueList<FromElement>();
+    private UniqueList<String> whereCriteria = new UniqueList<String>();
+    private UniqueList<String> orderByColumns = new UniqueList<String>();
+    private UniqueList<String> groupByColumns = new UniqueList<String>();
     private String having;
     private String limit;
     private String preLimit;
@@ -68,7 +68,7 @@ public class Query
      *
      * @return An UniqueList used to add modifiers.
      */
-    public UniqueList getSelectModifiers()
+    public UniqueList<String> getSelectModifiers()
     {
         return selectModifiers;
     }
@@ -78,7 +78,7 @@ public class Query
      *
      * @param modifiers the modifiers
      */
-    public void setSelectModifiers(UniqueList modifiers)
+    public void setSelectModifiers(UniqueList<String> modifiers)
     {
         selectModifiers = modifiers;
     }
@@ -90,7 +90,7 @@ public class Query
      *
      * @return An UniqueList used to add columns to be selected.
      */
-    public UniqueList getSelectClause()
+    public UniqueList<String> getSelectClause()
     {
         return selectColumns;
     }
@@ -100,7 +100,7 @@ public class Query
      *
      * @param columns columns list
      */
-    public void setSelectClause(UniqueList columns)
+    public void setSelectClause(UniqueList<String> columns)
     {
         selectColumns = columns;
     }
@@ -111,7 +111,7 @@ public class Query
      *
      * @return An UniqueList used to add tables involved in the query.
      */
-    public UniqueList getFromClause()
+    public UniqueList<FromElement> getFromClause()
     {
         return fromTables;
     }
@@ -121,7 +121,7 @@ public class Query
      *
      * @param tables the tables
      */
-    public void setFromClause(UniqueList tables)
+    public void setFromClause(UniqueList<FromElement> tables)
     {
         fromTables = tables;
     }
@@ -133,7 +133,7 @@ public class Query
      *
      * @return An UniqueList used to add selection criteria.
      */
-    public UniqueList getWhereClause()
+    public UniqueList<String> getWhereClause()
     {
         return whereCriteria;
     }
@@ -143,7 +143,7 @@ public class Query
      *
      * @param where where clause
      */
-    public void setWhereClause(UniqueList where)
+    public void setWhereClause(UniqueList<String> where)
     {
         whereCriteria = where;
     }
@@ -154,7 +154,7 @@ public class Query
      *
      * @return An UniqueList used to add columns to sort on.
      */
-    public UniqueList getOrderByClause()
+    public UniqueList<String> getOrderByClause()
     {
         return orderByColumns;
     }
@@ -165,7 +165,7 @@ public class Query
      *
      * @return An UniqueList used to add columns to group on.
      */
-    public UniqueList getGroupByClause()
+    public UniqueList<String> getGroupByClause()
     {
         return groupByColumns;
     }
@@ -343,9 +343,9 @@ public class Query
             .append(FROM);
 
         boolean first = true;
-        for (Iterator it = fromTables.iterator(); it.hasNext();)
+        for (Iterator<FromElement> it = fromTables.iterator(); it.hasNext();)
         {
-            FromElement fromElement = (FromElement) it.next();
+            FromElement fromElement = it.next();
 
             if (!first && fromElement.getJoinCondition() == null)
             {

Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/SQLBuilder.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/SQLBuilder.java?rev=1003834&r1=1003833&r2=1003834&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/SQLBuilder.java (original)
+++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/SQLBuilder.java Sat Oct  2 16:51:32 2010
@@ -230,23 +230,22 @@ public final class SQLBuilder
      * @param tableCallback A Callback Object
      * @return A Set of tables.
      */
-    public static Set getTableSet(
+    public static Set<String> getTableSet(
             final Criteria crit,
             final TableCallback tableCallback)
     {
-        HashSet tables = new HashSet();
+        Set<String> tables = new HashSet<String>();
 
         // Loop over all the Criterions
-        for (Iterator it = crit.keySet().iterator(); it.hasNext();)
+        for (Iterator<?> it = crit.keySet().iterator(); it.hasNext();)
         {
             String key = (String) it.next();
             Criteria.Criterion c = crit.getCriterion(key);
-            List tableNames = c.getAllTables();
+            List<String> tableNames = c.getAllTables();
 
             // Loop over all Tables referenced in this criterion.
-            for (Iterator it2 = tableNames.iterator(); it2.hasNext();)
+            for (String name : tableNames)
             {
-                String name = (String) it2.next();
                 String aliasName = crit.getTableForAlias(name);
 
                 // If the tables have an alias, add an "<xxx> AS <yyy> statement"
@@ -282,7 +281,7 @@ public final class SQLBuilder
      * @exception TorqueException if an error occurs
      */
     public static Query buildQueryClause(final Criteria crit,
-            final List params,
+            final List<Object> params,
             final QueryCallback qc)
             throws TorqueException
     {
@@ -322,12 +321,11 @@ public final class SQLBuilder
             final String dbName)
         throws TorqueException
     {
-        UniqueList selectClause = query.getSelectClause();
-        UniqueList select = criteria.getSelectColumns();
+        UniqueList<String> selectClause = query.getSelectClause();
+        UniqueList<String> select = criteria.getSelectColumns();
 
-        for (int i = 0; i < select.size(); i++)
+        for (String identifier : select)
         {
-            String identifier = (String) select.get(i);
             selectClause.add(identifier);
             addTableToFromClause(getTableName(identifier, dbName), criteria, query);
         }
@@ -342,13 +340,12 @@ public final class SQLBuilder
             final Criteria criteria,
             final Query query)
     {
-        UniqueList querySelectClause = query.getSelectClause();
-        Map criteriaAsColumns = criteria.getAsColumns();
+        UniqueList<String> querySelectClause = query.getSelectClause();
+        Map<String, String> criteriaAsColumns = criteria.getAsColumns();
 
-        for (Iterator it = criteriaAsColumns.entrySet().iterator(); it.hasNext();)
+        for (Map.Entry<String, String> entry : criteriaAsColumns.entrySet())
         {
-            Map.Entry entry = (Map.Entry) it.next();
-            String key = (String) entry.getKey();
+            String key = entry.getKey();
             querySelectClause.add(
                     new StringBuffer()
                     .append(entry.getValue())
@@ -367,11 +364,11 @@ public final class SQLBuilder
             final Criteria criteria,
             final Query query)
     {
-        UniqueList selectModifiers = query.getSelectModifiers();
-        UniqueList modifiers = criteria.getSelectModifiers();
-        for (int i = 0; i < modifiers.size(); i++)
+        UniqueList<String> selectModifiers = query.getSelectModifiers();
+        UniqueList<String> modifiers = criteria.getSelectModifiers();
+        for (String modifier : modifiers)
         {
-            selectModifiers.add(modifiers.get(i));
+            selectModifiers.add(modifier);
         }
     }
 
@@ -389,13 +386,13 @@ public final class SQLBuilder
             final String dbName,
             final Criteria crit,
             final Query query,
-            final List params,
+            final List<Object> params,
             final QueryCallback qc)
         throws TorqueException
     {
-        UniqueList whereClause = query.getWhereClause();
+        UniqueList<String> whereClause = query.getWhereClause();
 
-        for (Iterator it = crit.keySet().iterator(); it.hasNext();)
+        for (Iterator<?> it = crit.keySet().iterator(); it.hasNext();)
         {
             String key = (String) it.next();
             Criteria.Criterion criterion = crit.getCriterion(key);
@@ -446,19 +443,17 @@ public final class SQLBuilder
             final Query query)
             throws TorqueException
     {
-        UniqueList orderByClause = query.getOrderByClause();
-        UniqueList selectClause = query.getSelectClause();
+        UniqueList<String> orderByClause = query.getOrderByClause();
+        UniqueList<String> selectClause = query.getSelectClause();
 
-        UniqueList orderBy = crit.getOrderByColumns();
+        UniqueList<String> orderBy = crit.getOrderByColumns();
 
         if (orderBy != null && orderBy.size() > 0)
         {
             // Check for each String/Character column and apply
             // toUpperCase().
-            for (int i = 0; i < orderBy.size(); i++)
+            for (String orderByColumn : orderBy)
             {
-                String orderByColumn = (String) orderBy.get(i);
-
                 String strippedColumnName
                         = removeSQLFunction(orderByColumn);
                 int dotPos = strippedColumnName.lastIndexOf('.');
@@ -537,15 +532,14 @@ public final class SQLBuilder
             final Query query)
             throws TorqueException
     {
-        UniqueList groupByClause = query.getGroupByClause();
-        UniqueList groupBy = crit.getGroupByColumns();
+        UniqueList<String> groupByClause = query.getGroupByClause();
+        UniqueList<String> groupBy = crit.getGroupByColumns();
 
         // need to allow for multiple group bys
         if (groupBy != null)
         {
-            for (int i = 0; i < groupBy.size(); i++)
+            for (String columnName : groupBy)
             {
-                String columnName = (String) groupBy.get(i);
                 String column = (String) crit.getAsColumns().get(columnName);
 
                 if (column == null)
@@ -695,7 +689,7 @@ public final class SQLBuilder
      *         If tableName is null, true is returned.
      */
     public static boolean fromClauseContainsTableName(
-            final UniqueList fromClause,
+            final UniqueList<Query.FromElement> fromClause,
             final String tableName)
     {
         if (tableName == null)
@@ -705,10 +699,8 @@ public final class SQLBuilder
             // true is returned.
             return true;
         }
-        for (Iterator it = fromClause.iterator(); it.hasNext();)
+        for (Query.FromElement fromElement :  fromClause)
         {
-            Query.FromElement fromElement
-                    = (Query.FromElement) it.next();
             if (tableName.equals(fromElement.getTableName()))
             {
                 return true;
@@ -736,7 +728,7 @@ public final class SQLBuilder
         String tableNameForFromClause
                 = getTableNameForFromClause(tableName, criteria);
 
-        UniqueList queryFromClause = query.getFromClause();
+        UniqueList<Query.FromElement> queryFromClause = query.getFromClause();
 
         // it is important that this piece of code is executed AFTER
         // the joins are processed
@@ -765,7 +757,7 @@ public final class SQLBuilder
          * @param key The current criterion key.
          * @param crit The Criteria used in getTableSet()
          */
-        void process(Set tables, String key, Criteria crit);
+        void process(Set<String> tables, String key, Criteria crit);
     }
 
     /**
@@ -781,7 +773,7 @@ public final class SQLBuilder
          * @param params The parameter list passed to buildQueryString()
          * @return WHERE SQL fragment for this criterion
          */
-        String process(Criterion criterion, List params);
+        String process(Criterion criterion, List<Object> params);
     }
 
 }

Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/SqlExpression.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/SqlExpression.java?rev=1003834&r1=1003833&r2=1003834&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/SqlExpression.java (original)
+++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/SqlExpression.java Sat Oct  2 16:51:32 2010
@@ -24,6 +24,7 @@ import java.util.Date;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
+import java.util.Set;
 
 import org.apache.commons.lang.StringUtils;
 import org.apache.torque.TorqueException;
@@ -275,7 +276,7 @@ public final class SqlExpression
                         new SQLBuilder.QueryCallback() {
                             public String process(
                                     Criteria.Criterion criterion,
-                                    List params)
+                                    List<Object> params)
                             {
                                 return criterion.toString();
                             }
@@ -601,10 +602,10 @@ public final class SqlExpression
         }
 
         whereClause.append(comparison);
-        HashSet inClause = new HashSet();
+        Set<String> inClause = new HashSet<String>();
         if (criteria instanceof List)
         {
-            Iterator iter = ((List) criteria).iterator();
+            Iterator<Object> iter = ((List<Object>) criteria).iterator();
             while (iter.hasNext())
             {
                 Object value = iter.next();
@@ -617,7 +618,7 @@ public final class SqlExpression
         else if (criteria instanceof String)
         {
             // subquery
-            inClause.add(criteria);
+            inClause.add((String) criteria);
         }
         else
         {



---------------------------------------------------------------------
To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org


Mime
View raw message