cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mgen...@apache.org
Subject svn commit: r656716 - /cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/ModelerUtil.java
Date Thu, 15 May 2008 16:02:09 GMT
Author: mgentry
Date: Thu May 15 09:02:08 2008
New Revision: 656716

URL: http://svn.apache.org/viewvc?rev=656716&view=rev
Log:
Added generics to eliminate warnings.

Modified:
    cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/ModelerUtil.java

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/ModelerUtil.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/ModelerUtil.java?rev=656716&r1=656715&r2=656716&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/ModelerUtil.java
(original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/ModelerUtil.java
Thu May 15 09:02:08 2008
@@ -27,7 +27,6 @@
 import java.util.Calendar;
 import java.util.Collection;
 import java.util.HashSet;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Set;
 
@@ -102,7 +101,7 @@
 
     public static String[] getRegisteredTypeNames() {
         String[] explicitList = new ExtendedTypeMap().getRegisteredTypeNames();
-        Set nonPrimitives = new HashSet(Arrays.asList(explicitList));
+        Set<String> nonPrimitives = new HashSet<String>(Arrays.asList(explicitList));
 
         // add types that are not mapped explicitly, but nevertheless supported by Cayenne
         nonPrimitives.add(Calendar.class.getName());
@@ -140,19 +139,23 @@
     }
 
     public static DataNode getNodeLinkedToMap(DataDomain domain, DataMap map) {
-        Collection nodes = domain.getDataNodes();
+        Collection<DataNode> nodes = domain.getDataNodes();
 
         // go via an iterator in an indexed loop, since
         // we already obtained the size
         // (and index is required to initialize array)
-        Iterator nodesIt = nodes.iterator();
-        while (nodesIt.hasNext()) {
-            DataNode node = (DataNode) nodesIt.next();
-
-            if (node.getDataMaps().contains(map)) {
+        for (DataNode node : nodes)
+            if (node.getDataMaps().contains(map))
                 return node;
-            }
-        }
+            
+//        Iterator nodesIt = nodes.iterator();
+//        while (nodesIt.hasNext()) {
+//            DataNode node = (DataNode) nodesIt.next();
+//
+//            if (node.getDataMaps().contains(map)) {
+//                return node;
+//            }
+//        }
 
         return null;
     }



Mime
View raw message