You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by aa...@apache.org on 2007/11/20 19:30:38 UTC

svn commit: r596769 - in /cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne: ./ map/

Author: aadamchik
Date: Tue Nov 20 10:30:37 2007
New Revision: 596769

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

Modified:
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/CayenneDataObject.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/CallbackDescriptor.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/DataMap.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/DbAttribute.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/DbRelationship.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/Embeddable.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/EmbeddedAttribute.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/EntityResolver.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/MapLoader.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/MappingNamespace.java

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/CayenneDataObject.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/CayenneDataObject.java?rev=596769&r1=596768&r2=596769&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/CayenneDataObject.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/CayenneDataObject.java Tue Nov 20 10:30:37 2007
@@ -66,7 +66,7 @@
     protected Map values = new HashMap();
 
     /**
-     * Returns a DataContext that holds this object. Object becomes assocaiated with a
+     * Returns a DataContext that holds this object. Object becomes associated with a
      * DataContext either when the object is fetched using a query, or when a new object
      * is registered explicitly with a DataContext.
      * 
@@ -650,9 +650,7 @@
             // attributes, see if we have a target object set
             boolean validate = true;
             DbRelationship dbRelationship = (DbRelationship) dbRels.get(0);
-            Iterator joins = dbRelationship.getJoins().iterator();
-            while (joins.hasNext()) {
-                DbJoin join = (DbJoin) joins.next();
+            for (DbJoin join : dbRelationship.getJoins()) {
                 DbAttribute source = join.getSource();
 
                 if (source.isMandatory()) {

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/CallbackDescriptor.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/CallbackDescriptor.java?rev=596769&r1=596768&r2=596769&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/CallbackDescriptor.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/CallbackDescriptor.java Tue Nov 20 10:30:37 2007
@@ -19,7 +19,13 @@
 package org.apache.cayenne.map;
 
 import java.io.Serializable;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Set;
 
 /**
  * A mapping descriptor of a single callback event.
@@ -28,15 +34,13 @@
  * @author Andrus Adamchik
  */
 public class CallbackDescriptor implements Serializable {
-    
-   
 
     protected int callbackType;
-    protected Set callbackMethods;
+    protected Set<String> callbackMethods;
 
     public CallbackDescriptor(int callbackType) {
         setCallbackType(callbackType);
-        this.callbackMethods = new LinkedHashSet(3);
+        this.callbackMethods = new LinkedHashSet<String>(3);
     }
 
     /**
@@ -48,9 +52,10 @@
 
     /**
      * Returns all callback methods for this callback event.
+     * 
      * @return Returns all callback methods
      */
-    public Collection getCallbackMethods() {
+    public Collection<String> getCallbackMethods() {
         return Collections.unmodifiableCollection(callbackMethods);
     }
 
@@ -76,16 +81,17 @@
 
     /**
      * moves specified callback method to the specified position
-     *
+     * 
      * @param callbackMethod callbacm method name (should exist)
      * @param destinationIndex destinationi index (should be valid)
      * @return true if any changes were made
      */
     public boolean moveMethod(String callbackMethod, int destinationIndex) {
-        List callbackMethodsList = new ArrayList(callbackMethods);
+        List<String> callbackMethodsList = new ArrayList<String>(callbackMethods);
         int currentIndex = callbackMethodsList.indexOf(callbackMethod);
         if (currentIndex < 0)
-            throw new IllegalArgumentException("Unknown callback method: " + callbackMethod);
+            throw new IllegalArgumentException("Unknown callback method: "
+                    + callbackMethod);
 
         boolean changed = false;
 
@@ -109,12 +115,13 @@
     }
 
     /**
-     * replaces callback method at the specified position
+     * Replaces a callback method at the specified position
+     * 
      * @param index callback method index
      * @param method new callback method
      */
     public void setCallbackMethodAt(int index, String method) {
-        List callbackMethodsList = new ArrayList(callbackMethods);
+        List<String> callbackMethodsList = new ArrayList<String>(callbackMethods);
         callbackMethodsList.set(index, method);
         callbackMethods.clear();
         callbackMethods.addAll(callbackMethodsList);

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/DataMap.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/DataMap.java?rev=596769&r1=596768&r2=596769&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/DataMap.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/DataMap.java Tue Nov 20 10:30:37 2007
@@ -114,13 +114,13 @@
     protected boolean clientSupported;
     protected String defaultClientPackage;
 
-    private SortedMap embeddablesMap;
-    private SortedMap objEntityMap;
-    private SortedMap dbEntityMap;
-    private SortedMap procedureMap;
-    private SortedMap queryMap;
+    private SortedMap<String, Embeddable> embeddablesMap;
+    private SortedMap<String, ObjEntity> objEntityMap;
+    private SortedMap<String, DbEntity> dbEntityMap;
+    private SortedMap<String, Procedure> procedureMap;
+    private SortedMap<String, Query> queryMap;
 
-    private List defaultEntityListeners;
+    private List<EntityListener> defaultEntityListeners;
 
     /**
      * Creates a new unnamed DataMap.
@@ -136,13 +136,13 @@
         this(mapName, Collections.EMPTY_MAP);
     }
 
-    public DataMap(String mapName, Map properties) {
-        embeddablesMap = new TreeMap();
-        objEntityMap = new TreeMap();
-        dbEntityMap = new TreeMap();
-        procedureMap = new TreeMap();
-        queryMap = new TreeMap();
-        defaultEntityListeners = new ArrayList(3);
+    public DataMap(String mapName, Map<String, Object> properties) {
+        embeddablesMap = new TreeMap<String, Embeddable>();
+        objEntityMap = new TreeMap<String, ObjEntity>();
+        dbEntityMap = new TreeMap<String, DbEntity>();
+        procedureMap = new TreeMap<String, Procedure>();
+        queryMap = new TreeMap<String, Query>();
+        defaultEntityListeners = new ArrayList<EntityListener>(3);
 
         setName(mapName);
         initWithProperties(properties);
@@ -154,7 +154,7 @@
      * 
      * @since 1.1
      */
-    public void initWithProperties(Map properties) {
+    public void initWithProperties(Map<String, Object> properties) {
         // must init defaults even if properties are empty
         if (properties == null) {
             properties = Collections.EMPTY_MAP;
@@ -289,9 +289,9 @@
         encodeOBJRelationshipsAsXML(getObjEntityMap(), encoder);
         encoder.print(getQueryMap());
 
-        //write entity listeners
-        for(Iterator i = getDefaultEntityListeners().iterator(); i.hasNext();) {
-            EntityListener entityListener = (EntityListener)i.next();
+        // write entity listeners
+        for (Iterator i = getDefaultEntityListeners().iterator(); i.hasNext();) {
+            EntityListener entityListener = (EntityListener) i.next();
             entityListener.encodeAsXML(encoder);
         }
 
@@ -323,7 +323,7 @@
         while (it.hasNext()) {
             Map.Entry entry = (Map.Entry) it.next();
             ObjEntity entity = (ObjEntity) entry.getValue();
-            
+
             // filter out synthetic
             Iterator relationships = entity.getDeclaredRelationships().iterator();
             while (relationships.hasNext()) {
@@ -401,7 +401,7 @@
      * Returns a sorted unmodifiable map of ObjEntities contained in this DataMap, keyed
      * by ObjEntity name.
      */
-    public SortedMap getObjEntityMap() {
+    public SortedMap<String, ObjEntity> getObjEntityMap() {
         return Collections.unmodifiableSortedMap(objEntityMap);
     }
 
@@ -409,7 +409,7 @@
      * Returns a sorted unmodifiable map of DbEntities contained in this DataMap, keyed by
      * DbEntity name.
      */
-    public SortedMap getDbEntityMap() {
+    public SortedMap<String, DbEntity> getDbEntityMap() {
         return Collections.unmodifiableSortedMap(dbEntityMap);
     }
 
@@ -506,7 +506,7 @@
     /**
      * @since 1.1
      */
-    public SortedMap getQueryMap() {
+    public SortedMap<String, Query> getQueryMap() {
         return Collections.unmodifiableSortedMap(queryMap);
     }
 
@@ -515,7 +515,7 @@
      * 
      * @since 1.1
      */
-    public Collection getQueries() {
+    public Collection<Query> getQueries() {
         return Collections.unmodifiableCollection(queryMap.values());
     }
 
@@ -603,14 +603,14 @@
     /**
      * Returns an unmodifiable collection of ObjEntities stored in this DataMap.
      */
-    public Collection getObjEntities() {
+    public Collection<ObjEntity> getObjEntities() {
         return Collections.unmodifiableCollection(objEntityMap.values());
     }
 
     /**
      * @since 3.0
      */
-    public Map getEmbeddableMap() {
+    public Map<String, Embeddable> getEmbeddableMap() {
         return Collections.unmodifiableMap(embeddablesMap);
     }
 
@@ -619,7 +619,7 @@
      * 
      * @since 3.0
      */
-    public Collection getEmbeddables() {
+    public Collection<Embeddable> getEmbeddables() {
         return Collections.unmodifiableCollection(embeddablesMap.values());
     }
 
@@ -627,7 +627,7 @@
      * @since 3.0
      */
     public Embeddable getEmbeddable(String className) {
-        Embeddable e = (Embeddable) embeddablesMap.get(className);
+        Embeddable e = embeddablesMap.get(className);
         if (e != null) {
             return e;
         }
@@ -642,7 +642,7 @@
      * 
      * @since 3.0
      */
-    public List getDefaultEntityListeners() {
+    public List<EntityListener> getDefaultEntityListeners() {
         return Collections.unmodifiableList(defaultEntityListeners);
     }
 
@@ -686,9 +686,7 @@
      * @since 3.0
      */
     public EntityListener getDefaultEntityListener(String className) {
-        Iterator it = defaultEntityListeners.iterator();
-        while (it.hasNext()) {
-            EntityListener next = (EntityListener) it.next();
+        for (EntityListener next : defaultEntityListeners) {
             if (className.equals(next.getClassName())) {
                 return next;
             }
@@ -700,7 +698,7 @@
     /**
      * Returns all DbEntities in this DataMap.
      */
-    public Collection getDbEntities() {
+    public Collection<DbEntity> getDbEntities() {
         return Collections.unmodifiableCollection(dbEntityMap.values());
     }
 
@@ -709,7 +707,7 @@
      * be searched.
      */
     public DbEntity getDbEntity(String dbEntityName) {
-        DbEntity entity = (DbEntity) dbEntityMap.get(dbEntityName);
+        DbEntity entity = dbEntityMap.get(dbEntityName);
 
         if (entity != null) {
             return entity;
@@ -728,10 +726,7 @@
             return null;
         }
 
-        Iterator it = getObjEntityMap().entrySet().iterator();
-        while (it.hasNext()) {
-            Map.Entry entry = (Map.Entry) it.next();
-            ObjEntity entity = (ObjEntity) entry.getValue();
+        for (ObjEntity entity : getObjEntities()) {
             if (javaClassName.equals(entity.getClassName())) {
                 return entity;
             }
@@ -745,7 +740,7 @@
      * search a parent EntityNamespace.
      */
     public ObjEntity getObjEntity(String objEntityName) {
-        ObjEntity entity = (ObjEntity) objEntityMap.get(objEntityName);
+        ObjEntity entity = objEntityMap.get(objEntityName);
         if (entity != null) {
             return entity;
         }
@@ -756,25 +751,22 @@
     /**
      * Returns all ObjEntities mapped to the given DbEntity.
      */
-    public Collection getMappedEntities(DbEntity dbEntity) {
+    public Collection<ObjEntity> getMappedEntities(DbEntity dbEntity) {
         if (dbEntity == null) {
             return Collections.EMPTY_LIST;
         }
 
-        Collection allEntities = (namespace != null)
-                ? namespace.getObjEntities()
-                : getObjEntities();
+        Collection<ObjEntity> allEntities = (namespace != null) ? namespace
+                .getObjEntities() : getObjEntities();
 
         if (allEntities.isEmpty()) {
             return Collections.EMPTY_LIST;
         }
 
-        Collection result = new ArrayList();
-        Iterator iter = allEntities.iterator();
-        while (iter.hasNext()) {
-            ObjEntity objEnt = (ObjEntity) iter.next();
-            if (objEnt.getDbEntity() == dbEntity) {
-                result.add(objEnt);
+        Collection<ObjEntity> result = new ArrayList<ObjEntity>();
+        for (ObjEntity entity : allEntities) {
+            if (entity.getDbEntity() == dbEntity) {
+                result.add(entity);
             }
         }
 
@@ -885,7 +877,7 @@
     /**
      * Returns stored procedures associated with this DataMap.
      */
-    public Collection getProcedures() {
+    public Collection<Procedure> getProcedures() {
         return Collections.unmodifiableCollection(procedureMap.values());
     }
 
@@ -894,7 +886,7 @@
      * Procedure is not found in this DataMap, a parent EntityNamcespace is searched.
      */
     public Procedure getProcedure(String procedureName) {
-        Procedure procedure = (Procedure) procedureMap.get(procedureName);
+        Procedure procedure = procedureMap.get(procedureName);
         if (procedure != null) {
             return procedure;
         }
@@ -935,7 +927,7 @@
     /**
      * Returns a sorted unmodifiable map of Procedures in this DataMap keyed by name.
      */
-    public SortedMap getProcedureMap() {
+    public SortedMap<String, Procedure> getProcedureMap() {
         return Collections.unmodifiableSortedMap(procedureMap);
     }
 
@@ -1055,7 +1047,10 @@
     public void dbEntityChanged(EntityEvent e) {
         Entity entity = e.getEntity();
         if (entity instanceof DbEntity) {
-            ((DbEntity) entity).dbEntityChanged(e);
+
+            DbEntity dbEntity = (DbEntity) entity;
+
+            dbEntity.dbEntityChanged(e);
 
             // finish up the name change here because we
             // do not have direct access to the dbEntityMap
@@ -1064,7 +1059,7 @@
                 dbEntityMap.remove(e.getOldName());
 
                 // add the entity back in with the new name
-                dbEntityMap.put(e.getNewName(), entity);
+                dbEntityMap.put(e.getNewName(), dbEntity);
 
                 // important - clear parent namespace:
                 MappingNamespace ns = getNamespace();
@@ -1131,7 +1126,9 @@
     public void objEntityChanged(EntityEvent e) {
         Entity entity = e.getEntity();
         if (entity instanceof ObjEntity) {
-            ((ObjEntity) entity).objEntityChanged(e);
+
+            ObjEntity objEntity = (ObjEntity) entity;
+            objEntity.objEntityChanged(e);
 
             // finish up the name change here because we
             // do not have direct access to the objEntityMap
@@ -1140,7 +1137,7 @@
                 objEntityMap.remove(e.getOldName());
 
                 // add the entity back in with the new name
-                objEntityMap.put(e.getNewName(), entity);
+                objEntityMap.put(e.getNewName(), objEntity);
 
                 // important - clear parent namespace:
                 MappingNamespace ns = getNamespace();

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/DbAttribute.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/DbAttribute.java?rev=596769&r1=596768&r2=596769&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/DbAttribute.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/DbAttribute.java Tue Nov 20 10:30:37 2007
@@ -178,10 +178,8 @@
         Iterator relationships = getEntity().getRelationships().iterator();
         while (relationships.hasNext()) {
             DbRelationship relationship = (DbRelationship) relationships.next();
-            Iterator joins = relationship.getJoins().iterator();
 
-            while (joins.hasNext()) {
-                DbJoin join = (DbJoin) joins.next();
+            for (DbJoin join : relationship.getJoins()) {
                 if (name.equals(join.getSourceName())) {
                     DbAttribute target = join.getTarget();
                     if (target != null && target.isPrimaryKey()) {

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/DbRelationship.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/DbRelationship.java?rev=596769&r1=596768&r2=596769&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/DbRelationship.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/DbRelationship.java Tue Nov 20 10:30:37 2007
@@ -51,7 +51,7 @@
             "PropertyDidChange");
 
     // The columns through which the join is implemented.
-    protected List joins = new ArrayList();
+    protected List<DbJoin> joins = new ArrayList<DbJoin>(2);
 
     // Is relationship from source to target points to dependent primary
     // key (primary key column of destination table that is also a FK to the source
@@ -295,7 +295,7 @@
      * Returns a list of joins. List is returned by reference, so any modifications of the
      * list will affect this relationship.
      */
-    public List getJoins() {
+    public List<DbJoin> getJoins() {
         return joins;
     }
 

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/Embeddable.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/Embeddable.java?rev=596769&r1=596768&r2=596769&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/Embeddable.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/Embeddable.java Tue Nov 20 10:30:37 2007
@@ -21,7 +21,6 @@
 import java.io.Serializable;
 import java.util.Collection;
 import java.util.Collections;
-import java.util.Iterator;
 import java.util.SortedMap;
 import java.util.TreeMap;
 
@@ -40,14 +39,14 @@
 public class Embeddable implements XMLSerializable, Serializable {
 
     protected String className;
-    protected SortedMap attributes;
+    protected SortedMap<String, EmbeddableAttribute> attributes;
 
     public Embeddable() {
         this(null);
     }
 
     public Embeddable(String className) {
-        this.attributes = new TreeMap();
+        this.attributes = new TreeMap<String, EmbeddableAttribute>();
         this.className = className;
     }
 
@@ -56,21 +55,19 @@
      * <code>dbAttribute</code> parameter. Returns null if no such attribute is found.
      */
     public EmbeddableAttribute getAttributeForDbPath(String dbPath) {
-        Iterator it = attributes.values().iterator();
-        while (it.hasNext()) {
-            EmbeddableAttribute attribute = (EmbeddableAttribute) it.next();
+        for (EmbeddableAttribute attribute : attributes.values()) {
             if (dbPath.equals(attribute.getDbAttributeName())) {
                 return attribute;
             }
         }
-        
+
         return null;
     }
 
     /**
      * Returns an unmodifiable sorted map of embeddable attributes.
      */
-    public SortedMap getAttributeMap() {
+    public SortedMap<String, EmbeddableAttribute> getAttributeMap() {
         // create a new instance ... Caching unmodifiable map causes
         // serialization issues (esp. with Hessian).
         return Collections.unmodifiableSortedMap(attributes);
@@ -79,7 +76,7 @@
     /**
      * Returns an unmodifiable collection of embeddable attributes.
      */
-    public Collection getAttributes() {
+    public Collection<EmbeddableAttribute> getAttributes() {
         // create a new instance. Caching unmodifiable collection causes
         // serialization issues (esp. with Hessian).
         return Collections.unmodifiableCollection(attributes.values());

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/EmbeddedAttribute.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/EmbeddedAttribute.java?rev=596769&r1=596768&r2=596769&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/EmbeddedAttribute.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/EmbeddedAttribute.java Tue Nov 20 10:30:37 2007
@@ -21,7 +21,6 @@
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
-import java.util.Iterator;
 import java.util.Map;
 import java.util.SortedMap;
 import java.util.TreeMap;
@@ -39,10 +38,10 @@
 public class EmbeddedAttribute extends Attribute {
 
     protected String type;
-    protected SortedMap attributeOverrides;
+    protected SortedMap<String, String> attributeOverrides;
 
     public EmbeddedAttribute() {
-        attributeOverrides = new TreeMap();
+        attributeOverrides = new TreeMap<String, String>();
     }
 
     public EmbeddedAttribute(String name) {
@@ -73,16 +72,12 @@
         encoder.println('>');
 
         encoder.indent(1);
-        
-        
-        
-        Iterator it = attributeOverrides.entrySet().iterator();
-        while (it.hasNext()) {
-            Map.Entry e = (Map.Entry) it.next();
+
+        for (Map.Entry<String, String> e : attributeOverrides.entrySet()) {
             encoder.print("<embeddable-attribute-override name=\"");
-            encoder.print(e.getKey().toString());
+            encoder.print(e.getKey());
             encoder.print("\" db-attribute-path=\"");
-            encoder.print(e.getValue().toString());
+            encoder.print(e.getValue());
             encoder.println("\"/>");
         }
 
@@ -90,7 +85,7 @@
         encoder.println("</embedded-attribute>");
     }
 
-    public Map getAttributeOverrides() {
+    public Map<String, String> getAttributeOverrides() {
         return Collections.unmodifiableMap(attributeOverrides);
     }
 
@@ -137,11 +132,9 @@
 
         EmbeddableAttribute ea = null;
 
-        Iterator overrides = attributeOverrides.entrySet().iterator();
-        while (overrides.hasNext()) {
-            Map.Entry override = (Map.Entry) overrides.next();
+        for (Map.Entry<String, String> override : attributeOverrides.entrySet()) {
             if (dbPath.equals(override.getValue())) {
-                ea = e.getAttribute(override.getKey().toString());
+                ea = e.getAttribute(override.getKey());
                 break;
             }
         }
@@ -179,17 +172,17 @@
      * Returns a Collection of ObjAttributes of an embedded object taking into account
      * column name overrides.
      */
-    public Collection getAttributes() {
+    public Collection<ObjAttribute> getAttributes() {
         Embeddable e = getEmbeddable();
         if (e == null) {
             return Collections.EMPTY_LIST;
         }
 
-        Collection embeddableAttributes = e.getAttributes();
-        Collection objectAttributes = new ArrayList(embeddableAttributes.size());
-        Iterator it = embeddableAttributes.iterator();
-        while (it.hasNext()) {
-            EmbeddableAttribute ea = (EmbeddableAttribute) it.next();
+        Collection<EmbeddableAttribute> embeddableAttributes = e.getAttributes();
+        Collection<ObjAttribute> objectAttributes = new ArrayList<ObjAttribute>(
+                embeddableAttributes.size());
+
+        for (EmbeddableAttribute ea : embeddableAttributes) {
             objectAttributes.add(makeObjAttribute(ea));
         }
 
@@ -215,7 +208,7 @@
      * Returns Java class of an object property described by this attribute. Wraps any
      * thrown exceptions into CayenneRuntimeException.
      */
-    public Class getJavaClass() {
+    public Class<?> getJavaClass() {
         if (this.getType() == null) {
             return null;
         }

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/EntityResolver.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/EntityResolver.java?rev=596769&r1=596768&r2=596769&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/EntityResolver.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/EntityResolver.java Tue Nov 20 10:30:37 2007
@@ -25,7 +25,6 @@
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.Iterator;
-import java.util.List;
 import java.util.Map;
 
 import org.apache.cayenne.CayenneRuntimeException;
@@ -69,7 +68,7 @@
     protected transient Map dbEntityCache;
     protected transient Map objEntityCache;
     protected transient Map procedureCache;
-    protected List maps;
+    protected Collection<DataMap> maps;
     protected transient Map entityInheritanceCache;
     protected EntityResolver clientEntityResolver;
 
@@ -85,7 +84,7 @@
      */
     public EntityResolver() {
         this.indexedByClass = true;
-        this.maps = new ArrayList();
+        this.maps = new ArrayList<DataMap>(3);
         this.embeddableCache = new HashMap();
         this.queryCache = new HashMap();
         this.dbEntityCache = new HashMap();
@@ -279,44 +278,36 @@
     /**
      * Returns all DbEntities.
      */
-    public Collection getDbEntities() {
+    public Collection<DbEntity> getDbEntities() {
         CompositeCollection c = new CompositeCollection();
-        Iterator it = getDataMaps().iterator();
-        while (it.hasNext()) {
-            DataMap map = (DataMap) it.next();
+        for (DataMap map : getDataMaps()) {
             c.addComposited(map.getDbEntities());
         }
 
         return c;
     }
 
-    public Collection getObjEntities() {
+    public Collection<ObjEntity> getObjEntities() {
         CompositeCollection c = new CompositeCollection();
-        Iterator it = getDataMaps().iterator();
-        while (it.hasNext()) {
-            DataMap map = (DataMap) it.next();
+        for (DataMap map : getDataMaps()) {
             c.addComposited(map.getObjEntities());
         }
 
         return c;
     }
 
-    public Collection getProcedures() {
+    public Collection<Procedure> getProcedures() {
         CompositeCollection c = new CompositeCollection();
-        Iterator it = getDataMaps().iterator();
-        while (it.hasNext()) {
-            DataMap map = (DataMap) it.next();
+        for (DataMap map : getDataMaps()) {
             c.addComposited(map.getProcedures());
         }
 
         return c;
     }
 
-    public Collection getQueries() {
+    public Collection<Query> getQueries() {
         CompositeCollection c = new CompositeCollection();
-        Iterator it = getDataMaps().iterator();
-        while (it.hasNext()) {
-            DataMap map = (DataMap) it.next();
+        for (DataMap map : getDataMaps()) {
             c.addComposited(map.getQueries());
         }
 
@@ -402,25 +393,17 @@
 
         // index DbEntities separatly and before ObjEntities to avoid infinite loops when
         // looking up DbEntities during ObjEntity index op
-        Iterator mapIterator0 = maps.iterator();
-        while (mapIterator0.hasNext()) {
-            DataMap map = (DataMap) mapIterator0.next();
-
-            Iterator dbEntities = map.getDbEntities().iterator();
-            while (dbEntities.hasNext()) {
-                DbEntity de = (DbEntity) dbEntities.next();
+
+        for (DataMap map : maps) {
+            for (DbEntity de : map.getDbEntities()) {
                 dbEntityCache.put(de.getName(), de);
             }
         }
 
-        Iterator mapIterator1 = maps.iterator();
-        while (mapIterator1.hasNext()) {
-            DataMap map = (DataMap) mapIterator1.next();
+        for (DataMap map : maps) {
 
             // index ObjEntities
-            Iterator objEntities = map.getObjEntities().iterator();
-            while (objEntities.hasNext()) {
-                ObjEntity oe = (ObjEntity) objEntities.next();
+            for (ObjEntity oe : map.getObjEntities()) {
 
                 // index by name
                 objEntityCache.put(oe.getName(), oe);
@@ -476,12 +459,10 @@
             DataMap map = (DataMap) mapIterator2.next();
 
             // index ObjEntity inheritance
-            Iterator objEntities = map.getObjEntities().iterator();
-            while (objEntities.hasNext()) {
-                ObjEntity oe = (ObjEntity) objEntities.next();
+            for (ObjEntity oe : map.getObjEntities()) {
 
                 // build inheritance tree... include nodes that
-                // have no children to avoid uneeded cache rebuilding on lookup...
+                // have no children to avoid unneeded cache rebuilding on lookup...
                 EntityInheritanceTree node = (EntityInheritanceTree) entityInheritanceCache
                         .get(oe.getName());
                 if (node == null) {
@@ -535,7 +516,7 @@
         return null;
     }
 
-    public synchronized void setDataMaps(Collection maps) {
+    public synchronized void setDataMaps(Collection<DataMap> maps) {
         this.maps.clear();
         this.maps.addAll(maps);
         clearCache();
@@ -544,8 +525,8 @@
     /**
      * Returns an unmodifiable collection of DataMaps.
      */
-    public Collection getDataMaps() {
-        return Collections.unmodifiableList(maps);
+    public Collection<DataMap> getDataMaps() {
+        return Collections.unmodifiableCollection(maps);
     }
 
     /**

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/MapLoader.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/MapLoader.java?rev=596769&r1=596768&r2=596769&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/MapLoader.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/MapLoader.java Tue Nov 20 10:30:37 2007
@@ -133,7 +133,7 @@
     private Map<String, EndClosure> endTagOpMap;
     private String currentTag;
     private StringBuilder charactersBuffer;
-    private Map<String, String> mapProperties;
+    private Map<String, Object> mapProperties;
 
     public MapLoader() {
         // compile tag processors.
@@ -1050,7 +1050,7 @@
         }
 
         if (mapProperties == null) {
-            mapProperties = new TreeMap<String, String>();
+            mapProperties = new TreeMap<String, Object>();
         }
 
         mapProperties.put(name, value);

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/MappingNamespace.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/MappingNamespace.java?rev=596769&r1=596768&r2=596769&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/MappingNamespace.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/MappingNamespace.java Tue Nov 20 10:30:37 2007
@@ -67,20 +67,20 @@
     /**
      * Returns all DbEntities in the namespace.
      */
-    Collection getDbEntities();
+    Collection<DbEntity> getDbEntities();
 
     /**
      * Returns all ObjEntities in the namespace.
      */
-    Collection getObjEntities();
+    Collection<ObjEntity> getObjEntities();
 
     /**
      * Returns all Procedures in the namespace.
      */
-    Collection getProcedures();
+    Collection<Procedure> getProcedures();
 
     /**
      * Returns all Queries in the namespace.
      */
-    Collection getQueries();
+    Collection<Query> getQueries();
 }