cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kmen...@apache.org
Subject svn commit: r616529 - in /cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne: dba/ dba/openbase/ dba/oracle/ ejbql/parser/
Date Tue, 29 Jan 2008 21:39:15 GMT
Author: kmenard
Date: Tue Jan 29 13:39:14 2008
New Revision: 616529

URL: http://svn.apache.org/viewvc?rev=616529&view=rev
Log:
Generics.

Modified:
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/TypesHandler.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/openbase/OpenBaseAdapter.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/openbase/OpenBasePkGenerator.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/oracle/OracleLOBBatchAction.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/oracle/OraclePkGenerator.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/oracle/OracleProcedureAction.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/ejbql/parser/EJBQLSum.java

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/TypesHandler.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/TypesHandler.java?rev=616529&r1=616528&r2=616529&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/TypesHandler.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/TypesHandler.java
Tue Jan 29 13:39:14 2008
@@ -44,16 +44,16 @@
  */
 public class TypesHandler {
 
-    private static Map handlerMap = new HashMap();
+    private static Map<URL, TypesHandler> handlerMap = new HashMap<URL, TypesHandler>();
 
-    protected Map typesMap;
+    protected Map<Integer, String[]> typesMap;
 
     /**
      * @since 1.1
      */
     public static TypesHandler getHandler(URL typesConfig) {
         synchronized (handlerMap) {
-            TypesHandler handler = (TypesHandler) handlerMap.get(typesConfig);
+            TypesHandler handler = handlerMap.get(typesConfig);
 
             if (handler == null) {
                 handler = new TypesHandler(typesConfig);
@@ -104,7 +104,7 @@
     }
 
     public String[] externalTypesForJdbcType(int type) {
-        return (String[]) typesMap.get(Integer.valueOf(type));
+        return typesMap.get(Integer.valueOf(type));
     }
 
     /** 
@@ -115,11 +115,11 @@
         private static final String DB_TYPE_TAG = "db-type";
         private static final String NAME_ATTR = "name";
 
-        private Map types = new HashMap();
-        private List currentTypes = new ArrayList();
+        private Map<Integer, String[]> types = new HashMap<Integer, String[]>();
+        private List<String> currentTypes = new ArrayList<String>();
         private int currentType = TypesMapping.NOT_DEFINED;
 
-        public Map getTypes() {
+        public Map<Integer, String[]> getTypes() {
             return types;
         }
 

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/openbase/OpenBaseAdapter.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/openbase/OpenBaseAdapter.java?rev=616529&r1=616528&r2=616529&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/openbase/OpenBaseAdapter.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/openbase/OpenBaseAdapter.java
Tue Jan 29 13:39:14 2008
@@ -151,7 +151,7 @@
         buf.append("CREATE TABLE ").append(ent.getFullyQualifiedName()).append(" (");
 
         // columns
-        Iterator it = ent.getAttributes().iterator();
+        Iterator<DbAttribute> it = ent.getAttributes().iterator();
         boolean first = true;
         while (it.hasNext()) {
             if (first) {
@@ -161,7 +161,7 @@
                 buf.append(", ");
             }
 
-            DbAttribute at = (DbAttribute) it.next();
+            DbAttribute at = it.next();
 
             // attribute may not be fully valid, do a simple check
             if (at.getType() == TypesMapping.NOT_DEFINED) {

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/openbase/OpenBasePkGenerator.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/openbase/OpenBasePkGenerator.java?rev=616529&r1=616528&r2=616529&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/openbase/OpenBasePkGenerator.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/openbase/OpenBasePkGenerator.java
Tue Jan 29 13:39:14 2008
@@ -225,7 +225,7 @@
      */
     @Override
     public List createAutoPkStatements(List dbEntities) {
-        List list = new ArrayList(2 * dbEntities.size());
+        List<String> list = new ArrayList<String>(2 * dbEntities.size());
         Iterator it = dbEntities.iterator();
         while (it.hasNext()) {
             DbEntity entity = (DbEntity) it.next();

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/oracle/OracleLOBBatchAction.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/oracle/OracleLOBBatchAction.java?rev=616529&r1=616528&r2=616529&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/oracle/OracleLOBBatchAction.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/oracle/OracleLOBBatchAction.java
Tue Jan 29 13:39:14 2008
@@ -91,7 +91,7 @@
         // may be different depending on whether LOBs are NULL or not..
 
         LOBBatchQueryWrapper selectQuery = new LOBBatchQueryWrapper(query);
-        List qualifierAttributes = selectQuery.getDbAttributesForLOBSelectQualifier();
+        List<DbAttribute> qualifierAttributes = selectQuery.getDbAttributesForLOBSelectQualifier();
 
      
         boolean isLoggable = QueryLogger.isLoggable();
@@ -135,9 +135,9 @@
             Connection con,
             LOBBatchQueryBuilder queryBuilder,
             LOBBatchQueryWrapper selectQuery,
-            List qualifierAttributes) throws SQLException, Exception {
+            List<DbAttribute> qualifierAttributes) throws SQLException, Exception {
 
-        List lobAttributes = selectQuery.getDbAttributesForUpdatedLOBColumns();
+        List<DbAttribute> lobAttributes = selectQuery.getDbAttributesForUpdatedLOBColumns();
         if (lobAttributes.size() == 0) {
             return;
         }
@@ -163,7 +163,7 @@
         try {
             for (int i = 0; i < parametersSize; i++) {
                 Object value = qualifierValues.get(i);
-                DbAttribute attribute = (DbAttribute) qualifierAttributes.get(i);
+                DbAttribute attribute = qualifierAttributes.get(i);
 
                 adapter.bindParameter(
                         selectStatement,
@@ -183,7 +183,7 @@
                 // read the only expected row
 
                 for (int i = 0; i < lobSize; i++) {
-                    DbAttribute attribute = (DbAttribute) lobAttributes.get(i);
+                    DbAttribute attribute = lobAttributes.get(i);
                     int type = attribute.getType();
 
                     if (type == Types.CLOB) {

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/oracle/OraclePkGenerator.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/oracle/OraclePkGenerator.java?rev=616529&r1=616528&r2=616529&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/oracle/OraclePkGenerator.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/oracle/OraclePkGenerator.java
Tue Jan 29 13:39:14 2008
@@ -72,7 +72,7 @@
 
     @Override
     public List createAutoPkStatements(List dbEntities) {
-        List list = new ArrayList();
+        List<String> list = new ArrayList<String>();
         Iterator it = dbEntities.iterator();
         while (it.hasNext()) {
             DbEntity ent = (DbEntity) it.next();
@@ -98,7 +98,7 @@
 
     @Override
     public List dropAutoPkStatements(List dbEntities) {
-        List list = new ArrayList();
+        List<String> list = new ArrayList<String>();
         Iterator it = dbEntities.iterator();
         while (it.hasNext()) {
             DbEntity ent = (DbEntity) it.next();
@@ -288,7 +288,7 @@
                 QueryLogger.logQuery(sql, Collections.EMPTY_LIST);
                 ResultSet rs = sel.executeQuery(sql);
                 try {
-                    List sequenceList = new ArrayList();
+                    List<String> sequenceList = new ArrayList<String>();
                     while (rs.next()) {
                         sequenceList.add(rs.getString(1));
                     }

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/oracle/OracleProcedureAction.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/oracle/OracleProcedureAction.java?rev=616529&r1=616528&r2=616529&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/oracle/OracleProcedureAction.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/oracle/OracleProcedureAction.java
Tue Jan 29 13:39:14 2008
@@ -61,9 +61,9 @@
 
         // build result row...
         DataRow result = null;
-        List parameters = getProcedure().getCallParameters();
+        List<ProcedureParameter> parameters = getProcedure().getCallParameters();
         for (int i = 0; i < parameters.size(); i++) {
-            ProcedureParameter parameter = (ProcedureParameter) parameters.get(i);
+            ProcedureParameter parameter = parameters.get(i);
 
             if (!parameter.isOutParam()) {
                 continue;

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/ejbql/parser/EJBQLSum.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/ejbql/parser/EJBQLSum.java?rev=616529&r1=616528&r2=616529&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/ejbql/parser/EJBQLSum.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/ejbql/parser/EJBQLSum.java
Tue Jan 29 13:39:14 2008
@@ -32,10 +32,10 @@
     // per JPA spec, 4.8.4, SUM type mapping rules are a bit convoluted. Mapping them
     // here...
 
-    static final Map typeMap;
+    static final Map<String, String> typeMap;
 
     static {
-        typeMap = new HashMap();
+        typeMap = new HashMap<String, String>();
         typeMap.put(Integer.class.getName(), Long.class.getName());
         typeMap.put(Short.class.getName(), Long.class.getName());
         typeMap.put(Float.class.getName(), Double.class.getName());
@@ -64,7 +64,7 @@
 
         // type map only contains mappings that are different from the attribute path, so
         // if no mapping exists, return the argument passed to this method.
-        String mappedType = (String) typeMap.get(pathType);
+        String mappedType = typeMap.get(pathType);
         return mappedType != null ? mappedType : pathType;
     }
 }



Mime
View raw message