You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by am...@apache.org on 2007/12/02 23:19:54 UTC

svn commit: r600392 - in /cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne: conf/ gen/ project/ tools/ util/ validation/

Author: amaniatis
Date: Sun Dec  2 14:19:53 2007
New Revision: 600392

URL: http://svn.apache.org/viewvc?rev=600392&view=rev
Log:
generics

Modified:
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/conf/ConfigLoaderDelegate.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/conf/ConfigStatus.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/conf/Configuration.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/conf/RuntimeLoadDelegate.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/gen/EntityUtils.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/gen/ImportUtils.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/project/Project.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/project/ProjectConfigInfo.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/tools/DataPortTask.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/tools/DbGeneratorTask.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/tools/DeploymentConfigurator.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/util/NameConverter.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/util/PersistentObjectHolder.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/util/PersistentObjectList.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/util/RelationshipFault.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/util/ResourceLocator.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/util/Util.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/util/ZipUtil.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/validation/ValidationResult.java

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/conf/ConfigLoaderDelegate.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/conf/ConfigLoaderDelegate.java?rev=600392&r1=600391&r2=600392&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/conf/ConfigLoaderDelegate.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/conf/ConfigLoaderDelegate.java Sun Dec  2 14:19:53 2007
@@ -22,6 +22,8 @@
 
 import java.util.Map;
 
+import org.apache.cayenne.map.DataMap;
+
 /**
  * Interface that defines callback API used by ConfigLoader to process loaded
  * configuration. Main responsibility of ConfigLoaderDelegate is to create
@@ -65,7 +67,7 @@
     /**
      * @since 1.1
      */
-    public void shouldLoadDataMaps(String domainName, Map locations);
+    public void shouldLoadDataMaps(String domainName, Map<String, DataMap> locations);
     
     /**
      * @since 1.1

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/conf/ConfigStatus.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/conf/ConfigStatus.java?rev=600392&r1=600391&r2=600392&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/conf/ConfigStatus.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/conf/ConfigStatus.java Sun Dec  2 14:19:53 2007
@@ -32,12 +32,12 @@
  */
 public class ConfigStatus {
 
-    protected List otherFailures = new ArrayList();
-    protected Map failedMaps = new HashMap();
-    protected Map failedAdapters = new HashMap();
-    protected Map failedDataSources = new HashMap();
-    protected List failedMapRefs = new ArrayList();
-    protected Map messages = new HashMap();
+    protected List<String> otherFailures = new ArrayList<String>();
+    protected Map<String, String> failedMaps = new HashMap<String, String>();
+    protected Map<String, String> failedAdapters = new HashMap<String, String>();
+    protected Map<String, String> failedDataSources = new HashMap<String, String>();
+    protected List<String> failedMapRefs = new ArrayList<String>();
+    protected Map<String, Object> messages = new HashMap<String, Object>();
 
     public void addFailedMap(String name, String location, Object extraMessage) {
         failedMaps.put(name, location);
@@ -94,10 +94,10 @@
 
         StringBuffer buf = new StringBuffer();
 
-        Iterator it = failedMaps.keySet().iterator();
+        Iterator<String> it = failedMaps.keySet().iterator();
         while (it.hasNext()) {
-            String name = (String) it.next();
-            String location = (String) failedMaps.get(name);
+            String name = it.next();
+            String location = failedMaps.get(name);
             Object message = messages.get(getMapMessageKey(name, location));
             buf.append("\n\tdomain.map.name=").append(name).append(
                     ", domain.map.location=").append(location);
@@ -108,8 +108,8 @@
 
         it = failedAdapters.keySet().iterator();
         while (it.hasNext()) {
-            String node = (String) it.next();
-            String adapter = (String) failedAdapters.get(node);
+            String node = it.next();
+            String adapter = failedAdapters.get(node);
             Object message = messages.get(getAdapterMessageKey(node, adapter));
             buf.append("\n\tdomain.node.name=").append(node).append(
                     ", domain.node.adapter=").append(adapter);
@@ -120,8 +120,8 @@
 
         it = failedDataSources.keySet().iterator();
         while (it.hasNext()) {
-            String node = (String) it.next();
-            String location = (String) failedDataSources.get(node);
+            String node = it.next();
+            String location = failedDataSources.get(node);
             Object message = messages.get(getDataSourceMessageKey(node, location));
             buf.append("\n\tdomain.node.name=").append(node).append(
                     ", domain.node.datasource=").append(location);
@@ -132,7 +132,7 @@
 
         it = failedMapRefs.iterator();
         while (it.hasNext()) {
-            String mapName = (String) it.next();
+            String mapName = it.next();
             // don't report failed links if the DataMap itself failed to load
             if (failedMaps.get(mapName) == null) {
                 buf.append("\n\tdomain.node.map-ref.name=").append(mapName);
@@ -148,37 +148,37 @@
 
     /**
      * Returns a list of error messages not directly associated with project objects, such
-     * as XML pare exceptions, IOExceptions, etc.
+     * as XML parse exceptions, IOExceptions, etc.
      */
-    public List getOtherFailures() {
+    public List<String> getOtherFailures() {
         return otherFailures;
     }
 
     /**
      * Returns a list of map reference names that failed to load.
      */
-    public List getFailedMapRefs() {
+    public List<String> getFailedMapRefs() {
         return failedMapRefs;
     }
 
     /**
      * Returns a map of locations for names of the data maps that failed to load.
      */
-    public Map getFailedMaps() {
+    public Map<String, String> getFailedMaps() {
         return failedMaps;
     }
 
     /**
      * Returns a map of DataSource locations for node names that failed to load.
      */
-    public Map getFailedDataSources() {
+    public Map<String, String> getFailedDataSources() {
         return failedDataSources;
     }
 
     /**
      * Returns a map of adapter classes for node names that failed to load.
      */
-    public Map getFailedAdapters() {
+    public Map<String, String> getFailedAdapters() {
         return failedAdapters;
     }
 

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/conf/Configuration.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/conf/Configuration.java?rev=600392&r1=600391&r2=600392&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/conf/Configuration.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/conf/Configuration.java Sun Dec  2 14:19:53 2007
@@ -23,7 +23,6 @@
 import java.util.Collection;
 import java.util.Collections;
 import java.util.HashMap;
-import java.util.Iterator;
 import java.util.Map;
 import java.util.SortedMap;
 import java.util.TreeMap;
@@ -55,14 +54,14 @@
     private static Log logObj = LogFactory.getLog(Configuration.class);
 
     public static final String DEFAULT_DOMAIN_FILE = "cayenne.xml";
-    public static final Class DEFAULT_CONFIGURATION_CLASS = DefaultConfiguration.class;
+    public static final Class<DefaultConfiguration> DEFAULT_CONFIGURATION_CLASS = DefaultConfiguration.class;
 
     protected static Configuration sharedConfiguration;
 
     /**
      * Lookup map that stores DataDomains with names as keys.
      */
-    protected SortedMap dataDomains = new TreeMap();
+    protected SortedMap<String, DataDomain> dataDomains = new TreeMap<String, DataDomain>();
     protected DataSourceFactory overrideFactory;
     protected ConfigStatus loadStatus = new ConfigStatus();
     protected String domainConfigurationName = DEFAULT_DOMAIN_FILE;
@@ -70,7 +69,7 @@
     protected ConfigLoaderDelegate loaderDelegate;
     protected ConfigSaverDelegate saverDelegate;
     protected ConfigurationShutdownHook configurationShutdownHook;
-    protected Map dataViewLocations = new HashMap();
+    protected Map<String, String> dataViewLocations = new HashMap<String, String>();
     protected String projectVersion;
 
     /**
@@ -124,11 +123,11 @@
      * Creates and initializes a shared Configuration object of a custom Configuration
      * subclass.
      */
-    public static void initializeSharedConfiguration(Class configurationClass) {
+    public static void initializeSharedConfiguration(Class<? extends Configuration> configurationClass) {
         Configuration conf = null;
 
         try {
-            conf = (Configuration) configurationClass.newInstance();
+            conf = configurationClass.newInstance();
         }
         catch (Exception ex) {
             logObj.error("Error creating shared Configuration: ", ex);
@@ -291,7 +290,7 @@
             throw new NullPointerException("Attempt to add DataDomain with no name.");
         }
         
-        Object old = dataDomains.put(domain.getName(), domain);
+        DataDomain old = dataDomains.put(domain.getName(), domain);
         if (old != null && old != domain) {
             dataDomains.put(domain.getName(), old);
             throw new IllegalArgumentException("Attempt to overwrite domain with name "
@@ -309,7 +308,7 @@
      * such domain is found.
      */
     public DataDomain getDomain(String name) {
-        return (DataDomain) dataDomains.get(name);
+        return dataDomains.get(name);
     }
 
     /**
@@ -325,7 +324,7 @@
             return null;
         }
         else if (size == 1) {
-            return (DataDomain) dataDomains.values().iterator().next();
+            return dataDomains.values().iterator().next();
         }
         else {
             throw new CayenneRuntimeException(
@@ -340,7 +339,7 @@
      * caller to clean it up.
      */
     public void removeDomain(String name) {
-        DataDomain domain = (DataDomain) dataDomains.remove(name);
+        DataDomain domain = dataDomains.remove(name);
 
         if (domain != null) {
             domain.setEventManager(null);
@@ -350,7 +349,7 @@
     /**
      * Returns an unmodifiable collection of registered DataDomains sorted by domain name.
      */
-    public Collection getDomains() {
+    public Collection<DataDomain> getDomains() {
         return Collections.unmodifiableCollection(dataDomains.values());
     }
 
@@ -422,9 +421,9 @@
      * @since 1.1
      * @param dataViewLocations Map of DataView locations.
      */
-    public void setDataViewLocations(Map dataViewLocations) {
+    public void setDataViewLocations(Map<String, String> dataViewLocations) {
         if (dataViewLocations == null)
-            this.dataViewLocations = new HashMap();
+            this.dataViewLocations = new HashMap<String, String>();
         else
             this.dataViewLocations = dataViewLocations;
     }
@@ -435,7 +434,7 @@
      * 
      * @since 1.1
      */
-    public Map getDataViewLocations() {
+    public Map<String, String> getDataViewLocations() {
         return dataViewLocations;
     }
 
@@ -443,9 +442,7 @@
      * Shutdowns all owned domains. Invokes DataDomain.shutdown().
      */
     public void shutdown() {
-        Collection domains = getDomains();
-        for (Iterator i = domains.iterator(); i.hasNext();) {
-            DataDomain domain = (DataDomain) i.next();
+        for (DataDomain domain : getDomains()) {
             domain.shutdown();
         }
         
@@ -455,7 +452,6 @@
     }
 
     private class ConfigurationShutdownHook extends Thread {
-
         public void run() {
             shutdown();
         }

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/conf/RuntimeLoadDelegate.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/conf/RuntimeLoadDelegate.java?rev=600392&r1=600391&r2=600392&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/conf/RuntimeLoadDelegate.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/conf/RuntimeLoadDelegate.java Sun Dec  2 14:19:53 2007
@@ -21,7 +21,6 @@
 
 import java.io.InputStream;
 import java.util.HashMap;
-import java.util.Iterator;
 import java.util.Map;
 
 import javax.sql.DataSource;
@@ -54,12 +53,12 @@
 
     // TODO: andrus, 7/17/2006 - these variables, and project upgrade logic should be
     // refactored out of the MapLoader. In fact we should either modify raw XML during the
-    // upgrade, or implement some consistent upgrade API across variou loaders
+    // upgrade, or implement some consistent upgrade API across various loaders
     final static String _1_2_PACKAGE_PREFIX = "org.objectstyle.cayenne.";
     final static String _2_0_PACKAGE_PREFIX = "org.apache.cayenne.";
 
-    protected Map domains = new HashMap();
-    protected Map views = new HashMap();
+    protected Map<String, DataDomain> domains = new HashMap<String, DataDomain>();
+    protected Map<String, String> views = new HashMap<String, String>();
     protected ConfigStatus status;
     protected Configuration config;
     protected long startTime;
@@ -77,7 +76,7 @@
     }
 
     protected DataDomain findDomain(String name) throws FindException {
-        DataDomain domain = (DataDomain) domains.get(name);
+        DataDomain domain = domains.get(name);
         if (domain == null) {
             throw new FindException("Can't find DataDomain: " + name);
         }
@@ -152,7 +151,7 @@
         domains.put(domainName, new DataDomain(domainName));
     }
 
-    public void shouldLoadDataMaps(String domainName, Map locations) {
+    public void shouldLoadDataMaps(String domainName, Map<String, DataMap> locations) {
         if (locations.size() == 0) {
             return;
         }
@@ -167,9 +166,7 @@
         }
 
         // load DataMaps tree
-        Iterator it = locations.keySet().iterator();
-        while (it.hasNext()) {
-            String name = (String) it.next();
+        for (String name : locations.keySet()) {
             DataMap map = domain.getMap(name);
             if (map != null) {
                 continue;
@@ -417,7 +414,7 @@
      * 
      * @return List
      */
-    public Map getDomains() {
+    public Map<String, DataDomain> getDomains() {
         return domains;
     }
 
@@ -465,9 +462,7 @@
         }
 
         // load missing relationships and update configuration object
-        Iterator it = getDomains().values().iterator();
-        while (it.hasNext()) {
-            DataDomain domain = (DataDomain) it.next();
+        for (DataDomain domain : getDomains().values()) {
             updateDefaults(domain);
             config.addDomain(domain);
         }
@@ -489,13 +484,9 @@
     protected void updateDefaults(DataDomain domain) {
 
         // connect DB layer
-        Iterator maps = domain.getDataMaps().iterator();
-        while (maps.hasNext()) {
-            DataMap map = (DataMap) maps.next();
-
-            Iterator entities = map.getDbEntities().iterator();
-            while (entities.hasNext()) {
-                DbEntity entity = (DbEntity) entities.next();
+        for (DataMap map : domain.getDataMaps()) {
+
+            for (DbEntity entity : map.getDbEntities()) {
 
                 // iterate by copy to avoid concurrency modification errors on reflexive
                 // relationships
@@ -520,13 +511,9 @@
         }
 
         // connect object layer
-        maps = domain.getDataMaps().iterator();
-        while (maps.hasNext()) {
-            DataMap map = (DataMap) maps.next();
-
-            Iterator entities = map.getObjEntities().iterator();
-            while (entities.hasNext()) {
-                ObjEntity entity = (ObjEntity) entities.next();
+        for (DataMap map : domain.getDataMaps()) {
+
+            for (ObjEntity entity : map.getObjEntities()) {
 
                 // iterate by copy to avoid concurrency modification errors on reflexive
                 // relationships

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/gen/EntityUtils.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/gen/EntityUtils.java?rev=600392&r1=600391&r2=600392&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/gen/EntityUtils.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/gen/EntityUtils.java Sun Dec  2 14:19:53 2007
@@ -20,8 +20,6 @@
 
 package org.apache.cayenne.gen;
 
-import java.util.Iterator;
-
 import org.apache.cayenne.map.DataMap;
 import org.apache.cayenne.map.MappingNamespace;
 import org.apache.cayenne.map.ObjEntity;
@@ -143,9 +141,7 @@
             return false;
         }
 
-        Iterator it = anObjEntity.getRelationships().iterator();
-        while (it.hasNext()) {
-            Relationship r = (Relationship) it.next();
+        for (Relationship r : anObjEntity.getRelationships()) {
             if (r.isToMany()) {
                 return true;
             }
@@ -175,9 +171,7 @@
             return false;
         }
 
-        Iterator it = anObjEntity.getDeclaredRelationships().iterator();
-        while (it.hasNext()) {
-            Relationship r = (Relationship) it.next();
+        for (Relationship r : anObjEntity.getDeclaredRelationships()) {
             if (r.isToMany()) {
                 return true;
             }
@@ -201,9 +195,7 @@
             return false;
         }
 
-        Iterator it = anObjEntity.getRelationships().iterator();
-        while (it.hasNext()) {
-            Relationship r = (Relationship) it.next();
+        for (Relationship r : anObjEntity.getRelationships()) {
             if (false == r.isToMany()) {
                 return true;
             }
@@ -229,9 +221,7 @@
             return false;
         }
 
-        Iterator it = anObjEntity.getDeclaredRelationships().iterator();
-        while (it.hasNext()) {
-            Relationship r = (Relationship) it.next();
+        for (Relationship r : anObjEntity.getDeclaredRelationships()) {
             if (!r.isToMany()) {
                 return true;
             }

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/gen/ImportUtils.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/gen/ImportUtils.java?rev=600392&r1=600391&r2=600392&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/gen/ImportUtils.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/gen/ImportUtils.java Sun Dec  2 14:19:53 2007
@@ -24,7 +24,6 @@
 import java.util.Collections;
 import java.util.Comparator;
 import java.util.HashMap;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 
@@ -50,11 +49,11 @@
             Integer.class.getName()
     };
     
-    static Map classesForPrimitives = Util.toMap(primitives, primitiveClasses);
-    static Map primitivesForClasses = Util.toMap(primitiveClasses, primitives);
+    static Map<String, String> classesForPrimitives = Util.toMap(primitives, primitiveClasses);
+    static Map<String, String> primitivesForClasses = Util.toMap(primitiveClasses, primitives);
 
-    protected Map importTypesMap = new HashMap();
-    protected Map reservedImportTypesMap = new HashMap();  // Types forced to be FQN
+    protected Map<String, String> importTypesMap = new HashMap<String, String>();
+    protected Map<String, String> reservedImportTypesMap = new HashMap<String, String>();  // Types forced to be FQN
     
     protected String packageName;
     
@@ -72,7 +71,7 @@
         String typeClassName = stringUtils.stripPackageName(typeName);
         String typePackageName = stringUtils.stripClass(typeName);
         
-        if (typePackageName.length() == 0)  return false; // disallow non-packaged types (primatives, probably)
+        if (typePackageName.length() == 0)  return false; // disallow non-packaged types (primitives, probably)
         if ("java.lang".equals(typePackageName))  return false;
         
         // Can only have one type -- rest must use fqn
@@ -133,11 +132,11 @@
      */
     public String formatJavaType(String typeName, boolean usePrimitives) {
         if (usePrimitives) {
-            String primitive = (String) primitivesForClasses.get(typeName);
+            String primitive = primitivesForClasses.get(typeName);
             return (primitive != null) ? primitive : formatJavaType(typeName);
         }
         else {
-            String primitiveClass = (String) classesForPrimitives.get(typeName);
+            String primitiveClass = classesForPrimitives.get(typeName);
             return (primitiveClass != null)
                     ? formatJavaType(primitiveClass)
                     : formatJavaType(typeName);
@@ -173,7 +172,7 @@
      * @since 3.0
      */
     public String formatJavaTypeAsNonBooleanPrimitive(String type) {
-        String value = (String) ImportUtils.classesForPrimitives.get(type);
+        String value = ImportUtils.classesForPrimitives.get(type);
         return formatJavaType(value != null ? value : type);
     }
     
@@ -207,13 +206,10 @@
             outputBuffer.append(System.getProperty("line.separator"));
         }
 
-        List typesList = new ArrayList(importTypesMap.values());
-        Collections.sort(typesList, new Comparator() {
+        List<String> typesList = new ArrayList<String>(importTypesMap.values());
+        Collections.sort(typesList, new Comparator<String>() {
 
-            public int compare(Object o1, Object o2) {
-                
-                String s1 = (String)o1;
-                String s2 = (String)o2;
+            public int compare(String s1, String s2) {
                 
                 for (int index = 0; index < importOrdering.length; index++) {
                     String ordering = importOrdering[index];
@@ -229,24 +225,25 @@
         });
         
         String lastStringPrefix = null;
-        Iterator typesIterator = typesList.iterator();
-        while (typesIterator.hasNext()) {
-            String typeName = (String)typesIterator.next();
+        boolean firstIteration = true;
+        for (String typeName : typesList) {
 
+            if (firstIteration) {
+                firstIteration = false;
+            } else {
+                outputBuffer.append(System.getProperty("line.separator"));
+            }
             // Output another newline if we're in a different root package.
             // Find root package
             String thisStringPrefix = typeName;
             int dotIndex = typeName.indexOf('.');
-            if (-1 != dotIndex)
-            {
+            if (-1 != dotIndex) {
                 thisStringPrefix = typeName.substring(0, dotIndex);
             }
             // if this isn't the first import,
-            if (null != lastStringPrefix)
-            {
+            if (null != lastStringPrefix) {
                 // and it's different from the last import
-                if (false == thisStringPrefix.equals(lastStringPrefix))
-                {
+                if (false == thisStringPrefix.equals(lastStringPrefix)) {
                     // output a newline
                     outputBuffer.append(System.getProperty("line.separator"));
                 }
@@ -256,10 +253,6 @@
             outputBuffer.append("import ");
             outputBuffer.append(typeName);
             outputBuffer.append(';');
-            if (typesIterator.hasNext())
-            {
-                outputBuffer.append(System.getProperty("line.separator"));
-            }
         }
 
         return outputBuffer.toString();

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/project/Project.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/project/Project.java?rev=600392&r1=600391&r2=600392&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/project/Project.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/project/Project.java Sun Dec  2 14:19:53 2007
@@ -48,7 +48,7 @@
     static final int UPGRADE_STATUS_NEW = 1;
 
     protected File projectDir;
-    protected List files = new ArrayList();
+    protected List<ProjectFile> files = new ArrayList<ProjectFile>();
     protected int upgradeStatus;
     protected List upgradeMessages;
     protected boolean modified;
@@ -159,9 +159,8 @@
         }
 
         synchronized (files) {
-            Iterator it = files.iterator();
-            while (it.hasNext()) {
-                if (((ProjectFile) it.next()).isRenamed()) {
+            for (ProjectFile file : files) {
+                if (file.isRenamed()) {
                     return true;
                 }
             }
@@ -173,8 +172,8 @@
     /**
      * Creates a list of project files.
      */
-    public List buildFileList() {
-        List projectFiles = new ArrayList();
+    public List<ProjectFile> buildFileList() {
+        List<ProjectFile> projectFiles = new ArrayList<ProjectFile>();
 
         Iterator nodes = treeNodes();
         while (nodes.hasNext()) {
@@ -210,9 +209,7 @@
         // choice of collection here,
         // though normally projects have very few files...
         synchronized (files) {
-            Iterator it = files.iterator();
-            while (it.hasNext()) {
-                ProjectFile file = (ProjectFile) it.next();
+            for (ProjectFile file : files) {
                 if (file.getObject() == obj) {
                     return file;
                 }
@@ -339,29 +336,26 @@
         }
 
         // 1. Traverse project tree to find file wrappers that require update.
-        List filesToSave = new ArrayList();
-        List wrappedObjects = new ArrayList();
+        List<ProjectFile> filesToSave = new ArrayList<ProjectFile>();
+        List<Object> wrappedObjects = new ArrayList<Object>();
         prepareSave(filesToSave, wrappedObjects);
 
         // 2. Try saving individual file wrappers
         processSave(filesToSave);
 
         // 3. Commit changes
-        List savedFiles = new ArrayList();
-        Iterator saved = filesToSave.iterator();
-        while (saved.hasNext()) {
-            ProjectFile f = (ProjectFile) saved.next();
-            savedFiles.add(f.saveCommit());
+        List<File> savedFiles = new ArrayList<File>();
+        for (ProjectFile file : filesToSave) {
+            savedFiles.add(file.saveCommit());
         }
 
         // 4. Take care of deleted
         processDelete(wrappedObjects, savedFiles);
 
         // 5. Refresh file list
-        List freshList = buildFileList();
-        Iterator it = freshList.iterator();
-        while (it.hasNext()) {
-            ((ProjectFile) it.next()).synchronizeLocation();
+        List<ProjectFile> freshList = buildFileList();
+        for (ProjectFile file : freshList) {
+            file.synchronizeLocation();
         }
 
         files = freshList;
@@ -374,7 +368,7 @@
         setModified(false);
     }
 
-    protected void prepareSave(List filesToSave, List wrappedObjects)
+    protected void prepareSave(List<ProjectFile> filesToSave, List<Object> wrappedObjects)
             throws ProjectException {
         Iterator nodes = treeNodes();
         while (nodes.hasNext()) {
@@ -401,41 +395,31 @@
     /**
      * Saves a list of modified files to temporary files.
      */
-    protected void processSave(List modifiedFiles) throws ProjectException {
+    protected void processSave(List<ProjectFile> modifiedFiles) throws ProjectException {
         // notify that files will be saved
-        Iterator willSave = modifiedFiles.iterator();
-        while (willSave.hasNext()) {
-            ProjectFile f = (ProjectFile) willSave.next();
-            f.willSave();
+        for (ProjectFile file : modifiedFiles) {
+            file.willSave();
         }
 
         try {
-            Iterator modified = modifiedFiles.iterator();
-            while (modified.hasNext()) {
-                ProjectFile f = (ProjectFile) modified.next();
-                f.saveTemp();
+            for (ProjectFile file : modifiedFiles) {
+                file.saveTemp();
             }
         }
         catch (Exception ex) {
-
-            // revert
-            Iterator modified = modifiedFiles.iterator();
-            while (modified.hasNext()) {
-                ProjectFile f = (ProjectFile) modified.next();
-                f.saveUndo();
+            for (ProjectFile file : modifiedFiles) {
+                file.saveUndo();
             }
 
-            throw new ProjectException("Project save failed and was canceled.", ex);
+            throw new ProjectException("Project save failed and was cancelled.", ex);
         }
     }
 
-    protected void processDelete(List existingObjects, List savedFiles) {
+    protected void processDelete(List<Object> existingObjects, List<File> savedFiles) {
 
         // check for deleted
         synchronized (files) {
-            Iterator oldFiles = files.iterator();
-            while (oldFiles.hasNext()) {
-                ProjectFile f = (ProjectFile) oldFiles.next();
+            for (ProjectFile f : files) {
                 File file = f.resolveOldFile();
 
                 // this check is needed, since a file can reuse the name

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/project/ProjectConfigInfo.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/project/ProjectConfigInfo.java?rev=600392&r1=600391&r2=600392&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/project/ProjectConfigInfo.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/project/ProjectConfigInfo.java Sun Dec  2 14:19:53 2007
@@ -32,7 +32,7 @@
 	protected File sourceJar;
 	protected File destJar;
 	protected File altProjectFile;
-	protected List nodes = new ArrayList();
+	protected List<DataNodeConfigInfo> nodes = new ArrayList<DataNodeConfigInfo>();
 
 	public void addToNodes(DataNodeConfigInfo nodeInfo) {
 		nodes.add(nodeInfo);
@@ -58,7 +58,7 @@
 	 * Returns the nodes.
 	 * @return List
 	 */
-	public List getNodes() {
+	public List<DataNodeConfigInfo> getNodes() {
 		return nodes;
 	}
 
@@ -90,7 +90,7 @@
 	 * Sets the nodes.
 	 * @param nodes The nodes to set
 	 */
-	public void setNodes(List nodes) {
+	public void setNodes(List<DataNodeConfigInfo> nodes) {
 		this.nodes = nodes;
 	}
 

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/tools/DataPortTask.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/tools/DataPortTask.java?rev=600392&r1=600391&r2=600392&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/tools/DataPortTask.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/tools/DataPortTask.java Sun Dec  2 14:19:53 2007
@@ -22,7 +22,6 @@
 import java.io.File;
 import java.util.Collection;
 import java.util.HashSet;
-import java.util.Iterator;
 
 import org.apache.cayenne.access.DataDomain;
 import org.apache.cayenne.access.DataNode;
@@ -30,6 +29,7 @@
 import org.apache.cayenne.conf.Configuration;
 import org.apache.cayenne.conf.FileConfiguration;
 import org.apache.cayenne.map.DataMap;
+import org.apache.cayenne.map.DbEntity;
 import org.apache.cayenne.util.Util;
 import org.apache.tools.ant.BuildException;
 import org.apache.tools.ant.Project;
@@ -112,9 +112,7 @@
     }
 
     protected DataNode findNode(Configuration configuration, String name) {
-        Iterator domains = configuration.getDomains().iterator();
-        while (domains.hasNext()) {
-            DataDomain domain = (DataDomain) domains.next();
+        for (DataDomain domain : configuration.getDomains()) {
             DataNode node = domain.getNode(name);
             if (node != null) {
                 return node;
@@ -124,20 +122,16 @@
         return null;
     }
 
-    protected Collection getAllEntities(DataNode source, DataNode target) {
+    protected Collection<DbEntity> getAllEntities(DataNode source, DataNode target) {
         // use a set to exclude duplicates, though a valid project will probably have
         // none...
-        Collection allEntities = new HashSet();
+        Collection<DbEntity> allEntities = new HashSet<DbEntity>();
 
-        Iterator maps = source.getDataMaps().iterator();
-        while (maps.hasNext()) {
-            DataMap map = (DataMap) maps.next();
+        for (DataMap map : source.getDataMaps()) {
             allEntities.addAll(map.getDbEntities());
         }
 
-        maps = target.getDataMaps().iterator();
-        while (maps.hasNext()) {
-            DataMap map = (DataMap) maps.next();
+        for (DataMap map : target.getDataMaps()) {
             allEntities.addAll(map.getDbEntities());
         }
 

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/tools/DbGeneratorTask.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/tools/DbGeneratorTask.java?rev=600392&r1=600391&r2=600392&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/tools/DbGeneratorTask.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/tools/DbGeneratorTask.java Sun Dec  2 14:19:53 2007
@@ -187,7 +187,7 @@
         if (adapter != null) {
             // Try to create an instance of the DB adapter.
             try {
-                Class c = Class.forName(adapter);
+                Class<?> c = Class.forName(adapter);
                 this.adapter = (DbAdapter) c.newInstance();
             }
             catch (Exception e) {

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/tools/DeploymentConfigurator.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/tools/DeploymentConfigurator.java?rev=600392&r1=600391&r2=600392&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/tools/DeploymentConfigurator.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/tools/DeploymentConfigurator.java Sun Dec  2 14:19:53 2007
@@ -20,7 +20,6 @@
 package org.apache.cayenne.tools;
 
 import java.io.File;
-import java.util.Iterator;
 
 import org.apache.cayenne.project.DataNodeConfigInfo;
 import org.apache.cayenne.project.ProjectConfigInfo;
@@ -102,9 +101,7 @@
                     + info.getAltProjectFile());
         }
 
-        Iterator nodes = info.getNodes().iterator();
-        while (nodes.hasNext()) {
-            DataNodeConfigInfo node = (DataNodeConfigInfo) nodes.next();
+        for (DataNodeConfigInfo node : info.getNodes()) {
             if (node.getName() == null) {
                 throw new BuildException("'node.name' attribute is required.");
             }

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/util/NameConverter.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/util/NameConverter.java?rev=600392&r1=600391&r2=600392&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/util/NameConverter.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/util/NameConverter.java Sun Dec  2 14:19:53 2007
@@ -31,7 +31,7 @@
  */
 public class NameConverter {
 
-    private static final Map SPECIAL_CHAR_TO_JAVA_MAPPING = new HashMap();
+    private static final Map<String, String> SPECIAL_CHAR_TO_JAVA_MAPPING = new HashMap<String, String>();
 
     static {
         SPECIAL_CHAR_TO_JAVA_MAPPING.put("#", "pound");

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/util/PersistentObjectHolder.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/util/PersistentObjectHolder.java?rev=600392&r1=600391&r2=600392&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/util/PersistentObjectHolder.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/util/PersistentObjectHolder.java Sun Dec  2 14:19:53 2007
@@ -39,6 +39,7 @@
     protected Object value;
 
     // exists for the benefit of manual serialization schemes such as the one in Hessian.
+    @SuppressWarnings("unused")
     private PersistentObjectHolder() {
         fault = true;
     }

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/util/PersistentObjectList.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/util/PersistentObjectList.java?rev=600392&r1=600391&r2=600392&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/util/PersistentObjectList.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/util/PersistentObjectList.java Sun Dec  2 14:19:53 2007
@@ -46,6 +46,7 @@
     protected LinkedList removedFromUnresolved;
 
     // exists for the benefit of manual serialization schemes such as the one in Hessian.
+    @SuppressWarnings("unused")
     private PersistentObjectList() {
 
     }

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/util/RelationshipFault.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/util/RelationshipFault.java?rev=600392&r1=600391&r2=600392&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/util/RelationshipFault.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/util/RelationshipFault.java Sun Dec  2 14:19:53 2007
@@ -32,7 +32,7 @@
 import org.apache.cayenne.reflect.Property;
 
 /**
- * An abstract superlcass of lazily faulted to-one and to-many relationships.
+ * An abstract superclass of lazily faulted to-one and to-many relationships.
  * 
  * @since 1.2
  * @author Andrus Adamchik

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/util/ResourceLocator.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/util/ResourceLocator.java?rev=600392&r1=600391&r2=600392&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/util/ResourceLocator.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/util/ResourceLocator.java Sun Dec  2 14:19:53 2007
@@ -26,7 +26,6 @@
 import java.net.MalformedURLException;
 import java.net.URL;
 import java.util.ArrayList;
-import java.util.Iterator;
 import java.util.List;
 
 import org.apache.commons.logging.Log;
@@ -48,8 +47,8 @@
     protected boolean skipHomeDirectory;
 
     // additional lookup paths (as Strings)
-    protected List additionalClassPaths;
-    protected List additionalFilesystemPaths;
+    protected List<String> additionalClassPaths;
+    protected List<String> additionalFilesystemPaths;
 
     // ClassLoader used for resource loading
     protected ClassLoader classLoader;
@@ -215,7 +214,7 @@
      * Returns a base URL as a String from which this class was loaded. This is normally a
      * JAR or a file URL, but it is ClassLoader dependent.
      */
-    public static String classBaseUrl(Class aClass) {
+    public static String classBaseUrl(Class<?> aClass) {
         String pathToClass = aClass.getName().replace('.', '/') + ".class";
         ClassLoader classLoader = aClass.getClassLoader();
 
@@ -238,8 +237,8 @@
      * directory, current directory and CLASSPATH.
      */
     public ResourceLocator() {
-        this.additionalClassPaths = new ArrayList();
-        this.additionalFilesystemPaths = new ArrayList();
+        this.additionalClassPaths = new ArrayList<String>();
+        this.additionalFilesystemPaths = new ArrayList<String>();
     }
 
     /**
@@ -315,9 +314,8 @@
 
         if (!additionalFilesystemPaths.isEmpty()) {
             logObj.debug("searching additional paths: " + this.additionalFilesystemPaths);
-            Iterator pi = this.additionalFilesystemPaths.iterator();
-            while (pi.hasNext()) {
-                File f = new File((String) pi.next(), name);
+            for (String filePath : this.additionalFilesystemPaths) {
+                File f = new File(filePath, name);
                 logObj.debug("searching for: " + f.getAbsolutePath());
                 if (f.exists()) {
                     try {
@@ -337,9 +335,9 @@
             if (!this.additionalClassPaths.isEmpty()) {
                 logObj.debug("searching additional classpaths: "
                         + this.additionalClassPaths);
-                Iterator cpi = this.additionalClassPaths.iterator();
-                while (cpi.hasNext()) {
-                    String fullName = cpi.next() + "/" + name;
+
+                for (String classPath : this.additionalClassPaths) {
+                    String fullName = classPath + "/" + name;
                     logObj.debug("searching for: " + fullName);
                     URL url = findURLInClassLoader(fullName, getClassLoader());
                     if (url != null) {

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/util/Util.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/util/Util.java?rev=600392&r1=600391&r2=600392&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/util/Util.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/util/Util.java Sun Dec  2 14:19:53 2007
@@ -277,7 +277,7 @@
      * 
      * @since 1.1
      */
-    public static int nullSafeCompare(boolean nullsFirst, Comparable o1, Object o2) {
+    public static <T> int nullSafeCompare(boolean nullsFirst, Comparable<T> o1, T o2) {
         if (o1 == null && o2 == null) {
             return 0;
         }
@@ -360,13 +360,13 @@
      * 
      * @since 1.2
      */
-    public static Map toMap(Object[] keys, Object[] values) {
+    public static <K,V> Map<K,V> toMap(K[] keys, V[] values) {
         int keysSize = (keys != null) ? keys.length : 0;
         int valuesSize = (values != null) ? values.length : 0;
 
         if (keysSize == 0 && valuesSize == 0) {
             // return mutable map
-            return new HashMap();
+            return new HashMap<K,V>();
         }
 
         if (keysSize != valuesSize) {
@@ -374,7 +374,7 @@
                     "The number of keys doesn't match the number of values.");
         }
 
-        Map map = new HashMap();
+        Map<K,V> map = new HashMap<K,V>();
         for (int i = 0; i < keysSize; i++) {
             map.put(keys[i], values[i]);
         }
@@ -503,8 +503,8 @@
      * since it is much less efficient then just sorting a collection that backs the
      * original iterator.
      */
-    public static Iterator sortedIterator(Iterator it, Comparator comparator) {
-        List list = new ArrayList();
+    public static <T> Iterator<T> sortedIterator(Iterator<T> it, Comparator<T> comparator) {
+        List<T> list = new ArrayList<T>();
         while (it.hasNext()) {
             list.add(it.next());
         }
@@ -516,10 +516,11 @@
     /**
      * Builds a hashCode of Collection.
      */
-    public static int hashCode(Collection c) {
+    public static int hashCode(Collection<?> c) {
         HashCodeBuilder builder = new HashCodeBuilder();
-        for (Iterator i = c.iterator(); i.hasNext();)
-            builder.append(i.next());
+        for (Object o : c) {
+            builder.append(o);
+        }
         return builder.toHashCode();
     }
 
@@ -550,7 +551,7 @@
      * 
      * @since 1.2
      */
-    public static Class getJavaClass(String className) throws ClassNotFoundException {
+    public static Class<?> getJavaClass(String className) throws ClassNotFoundException {
 
         // is there a better way to get array class from string name?
 

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/util/ZipUtil.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/util/ZipUtil.java?rev=600392&r1=600391&r2=600392&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/util/ZipUtil.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/util/ZipUtil.java Sun Dec  2 14:19:53 2007
@@ -57,11 +57,11 @@
         ZipFile zip = new ZipFile(zipFile);
 
         try {
-            Enumeration en = zip.entries();
+            Enumeration<? extends ZipEntry> en = zip.entries();
             int bufSize = 8 * 1024;
 
             while (en.hasMoreElements()) {
-                ZipEntry entry = (ZipEntry) en.nextElement();
+                ZipEntry entry = en.nextElement();
                 File file =
                     (destDir != null)
                         ? new File(destDir, entry.getName())

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/validation/ValidationResult.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/validation/ValidationResult.java?rev=600392&r1=600391&r2=600392&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/validation/ValidationResult.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/validation/ValidationResult.java Sun Dec  2 14:19:53 2007
@@ -22,7 +22,6 @@
 import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.Collections;
-import java.util.Iterator;
 import java.util.List;
 
 import org.apache.cayenne.util.Util;
@@ -37,10 +36,10 @@
  */
 public class ValidationResult implements Serializable {
 
-    private List failures;
+    private List<ValidationFailure> failures;
 
     public ValidationResult() {
-        failures = new ArrayList();
+        failures = new ArrayList<ValidationFailure>();
     }
 
     /**
@@ -60,7 +59,7 @@
     /**
      * Returns all failures added to this result, or empty list is result has no failures.
      */
-    public List getFailures() {
+    public List<ValidationFailure> getFailures() {
         return Collections.unmodifiableList(failures);
     }
 
@@ -71,12 +70,9 @@
      * @param source it may be null.
      * @see ValidationFailure#getSource()
      */
-    public List getFailures(Object source) {
-
-        ArrayList matchingFailures = new ArrayList(5);
-        Iterator it = failures.iterator();
-        while (it.hasNext()) {
-            ValidationFailure failure = (ValidationFailure) it.next();
+    public List<ValidationFailure> getFailures(Object source) {
+        ArrayList<ValidationFailure> matchingFailures = new ArrayList<ValidationFailure>(5);
+        for (ValidationFailure failure : failures) {
             if (Util.nullSafeEquals(source, failure.getSource())) {
                 matchingFailures.add(failure);
             }
@@ -99,9 +95,7 @@
      *         otherwise.
      */
     public boolean hasFailures(Object source) {
-        Iterator it = failures.iterator();
-        while (it.hasNext()) {
-            ValidationFailure failure = (ValidationFailure) it.next();
+        for (ValidationFailure failure : failures) {
             if (Util.nullSafeEquals(source, failure.getSource())) {
                 return true;
             }
@@ -114,13 +108,11 @@
         StringBuffer ret = new StringBuffer();
         String separator = System.getProperty("line.separator");
 
-        Iterator it = getFailures().iterator();
-        while (it.hasNext()) {
+        for (ValidationFailure failure : failures) {
             if (ret.length() > 0) {
                 ret.append(separator);
             }
-
-            ret.append(it.next());
+            ret.append(failure);
         }
 
         return ret.toString();