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 2010/05/31 13:25:12 UTC

svn commit: r949719 - in /cayenne/main/trunk: docs/doc/src/main/resources/ framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/ framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/ framework/cayenne-jdk1.5-unp...

Author: aadamchik
Date: Mon May 31 11:25:12 2010
New Revision: 949719

URL: http://svn.apache.org/viewvc?rev=949719&view=rev
Log:
CAY-1439 ClassDescriptor refactoring - replacing returned iterators with collections

* converted 'getIdProperties'
* converted 'getDiscriminatorColumns'
* converted 'getMapArcProperties'

Modified:
    cayenne/main/trunk/docs/doc/src/main/resources/RELEASE-NOTES.txt
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/CayenneContextGraphManager.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/DataDomainSyncBucket.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/PrefetchProcessorJointNode.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/jdbc/EJBQLIdentifierColumnsTranslator.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/ejbql/parser/Compiler.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/reflect/ClassDescriptor.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/reflect/LazyClassDescriptorDecorator.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/reflect/PersistentDescriptor.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/reflect/MockClassDescriptor.java

Modified: cayenne/main/trunk/docs/doc/src/main/resources/RELEASE-NOTES.txt
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/docs/doc/src/main/resources/RELEASE-NOTES.txt?rev=949719&r1=949718&r2=949719&view=diff
==============================================================================
--- cayenne/main/trunk/docs/doc/src/main/resources/RELEASE-NOTES.txt (original)
+++ cayenne/main/trunk/docs/doc/src/main/resources/RELEASE-NOTES.txt Mon May 31 11:25:12 2010
@@ -42,6 +42,7 @@ CAY-1424 DI: support for named service i
 CAY-1425 Remove Configuration sharedConfiguration singleton affecting DataContext deserialization, CayenneDataObject XML deserialization, DataContext static factory method. 
 CAY-1433 Change #chunk behaviour to skipe only null arguments (don't skip 0 or false)
 CAY-1438 refactoring EntityInheritanceTree lookups
+CAY-1439 ClassDescriptor refactoring - replacing returned iterators with collections
 
 Bug Fixes Since 3.0:
 

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/CayenneContextGraphManager.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/CayenneContextGraphManager.java?rev=949719&r1=949718&r2=949719&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/CayenneContextGraphManager.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/CayenneContextGraphManager.java Mon May 31 11:25:12 2010
@@ -160,16 +160,14 @@ final class CayenneContextGraphManager e
 
         while (it.hasNext()) {
             ObjectId id = (ObjectId) it.next();
-            ClassDescriptor descriptor = resolver.getClassDescriptor(id
-                    .getEntityName());
+            ClassDescriptor descriptor = resolver.getClassDescriptor(id.getEntityName());
 
-            Iterator<ArcProperty> mapArcProperties = descriptor.getMapArcProperties();
-            if (mapArcProperties.hasNext()) {
+            Collection<ArcProperty> mapArcProperties = descriptor.getMapArcProperties();
+            if (!mapArcProperties.isEmpty()) {
 
                 Object object = getNode(id);
 
-                while (mapArcProperties.hasNext()) {
-                    ArcProperty arc = mapArcProperties.next();
+                for (ArcProperty arc : mapArcProperties) {
                     ToManyMapProperty reverseArc = (ToManyMapProperty) arc
                             .getComplimentaryReverseArc();
 
@@ -206,15 +204,15 @@ final class CayenneContextGraphManager e
         while (it.hasNext()) {
             Map.Entry<?, ?> e = (Map.Entry<?, ?>) it.next();
             if (e.getValue() == target) {
-                //this remove does not trigger event in PersistentObjectMap
+                // this remove does not trigger event in PersistentObjectMap
                 it.remove();
                 break;
             }
         }
 
-        //TODO: (andrey, 25/11/09 - this is a hack to prevent event triggering 
+        // TODO: (andrey, 25/11/09 - this is a hack to prevent event triggering
         // (and concurrent exceptions)
-        //should find a way to get rid of type casting
+        // should find a way to get rid of type casting
         ((PersistentObjectMap) map).putDirectly(newKey, target);
     }
 

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/DataDomainSyncBucket.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/DataDomainSyncBucket.java?rev=949719&r1=949718&r2=949719&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/DataDomainSyncBucket.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/DataDomainSyncBucket.java Mon May 31 11:25:12 2010
@@ -40,7 +40,6 @@ import org.apache.cayenne.query.Query;
 import org.apache.cayenne.reflect.ArcProperty;
 import org.apache.cayenne.reflect.AttributeProperty;
 import org.apache.cayenne.reflect.ClassDescriptor;
-import org.apache.cayenne.reflect.Property;
 import org.apache.cayenne.reflect.PropertyException;
 import org.apache.cayenne.reflect.ToManyMapProperty;
 import org.apache.commons.collections.Factory;
@@ -187,10 +186,8 @@ abstract class DataDomainSyncBucket {
                     if (id.isReplacementIdAttached()) {
 
                         Map<String, Object> replacement = id.getReplacementIdMap();
-                        Iterator<Property> idProperties = descriptor.getIdProperties();
-                        while (idProperties.hasNext()) {
-                            AttributeProperty property = (AttributeProperty) idProperties
-                                    .next();
+                        for (AttributeProperty property : descriptor.getIdProperties()) {
+
                             Object value = replacement.get(property
                                     .getAttribute()
                                     .getDbAttributeName());
@@ -235,10 +232,7 @@ abstract class DataDomainSyncBucket {
                     modifiedSnapshots.put(finalId, dataRow);
 
                     // update Map reverse relationships
-                    Iterator<ArcProperty> mapArcProperties = descriptor
-                            .getMapArcProperties();
-                    while (mapArcProperties.hasNext()) {
-                        ArcProperty arc = mapArcProperties.next();
+                    for (ArcProperty arc : descriptor.getMapArcProperties()) {
                         ToManyMapProperty reverseArc = (ToManyMapProperty) arc
                                 .getComplimentaryReverseArc();
 

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/PrefetchProcessorJointNode.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/PrefetchProcessorJointNode.java?rev=949719&r1=949718&r2=949719&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/PrefetchProcessorJointNode.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/PrefetchProcessorJointNode.java Mon May 31 11:25:12 2010
@@ -227,10 +227,7 @@ class PrefetchProcessorJointNode extends
         }
 
         // append inheritance discriminator columns...
-        Iterator<ObjAttribute> discriminatorColumns = descriptor
-                .getDiscriminatorColumns();
-        while (discriminatorColumns.hasNext()) {
-            ObjAttribute column = discriminatorColumns.next();
+        for (ObjAttribute column : descriptor.getDiscriminatorColumns()) {
             String target = column.getDbAttributePath();
             appendColumn(targetSource, target, prefix + target);
         }

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/jdbc/EJBQLIdentifierColumnsTranslator.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/jdbc/EJBQLIdentifierColumnsTranslator.java?rev=949719&r1=949718&r2=949719&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/jdbc/EJBQLIdentifierColumnsTranslator.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/jdbc/EJBQLIdentifierColumnsTranslator.java Mon May 31 11:25:12 2010
@@ -148,15 +148,12 @@ class EJBQLIdentifierColumnsTranslator e
         }
 
         // append inheritance discriminator columns...
-        Iterator<ObjAttribute> discriminatorColumns = descriptor.getDiscriminatorColumns();
-        while (discriminatorColumns.hasNext()) {
-            
-            ObjAttribute attribute = discriminatorColumns.next();
-            appendColumn(idVar, attribute, attribute.getDbAttribute(), fields);
+        for (ObjAttribute column : descriptor.getDiscriminatorColumns()) {
+            appendColumn(idVar, column, column.getDbAttribute(), fields);
         }
 
         addPrefetchedColumnsIfAny(idVar);
-        
+
         return false;
     }
 
@@ -223,12 +220,13 @@ class EJBQLIdentifierColumnsTranslator e
             String javaType) {
         String columnLabel = "";
         if (context.isAppendingResultColumns()) {
-               columnLabel = fields.get(property != null ? property
-                        .getDbAttributePath() : column.getName());
+            columnLabel = fields.get(property != null
+                    ? property.getDbAttributePath()
+                    : column.getName());
         }
         appendColumn(identifier, column, columnLabel, columnLabel, javaType);
     }
-    
+
     public void appendColumn(
             String identifier,
             DbAttribute column,

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/ejbql/parser/Compiler.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/ejbql/parser/Compiler.java?rev=949719&r1=949718&r2=949719&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/ejbql/parser/Compiler.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/ejbql/parser/Compiler.java Mon May 31 11:25:12 2010
@@ -22,7 +22,6 @@ import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashMap;
 import java.util.HashSet;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -71,7 +70,7 @@ class Compiler {
     private EJBQLExpressionVisitor rootDescriptorVisitor;
     private List<Object> resultComponents;
     private PrefetchTreeNode prefetchTree = null;
-    
+
     Compiler(EntityResolver resolver) {
         this.resolver = resolver;
         this.descriptorsById = new HashMap<String, ClassDescriptor>();
@@ -87,7 +86,7 @@ class Compiler {
         parsed.visit(new CompilationVisitor());
 
         Map<EJBQLPath, Integer> pathsInSelect = new HashMap<EJBQLPath, Integer>();
-       
+
         if (parsed != null) {
             for (int i = 0; i < parsed.getChildrenCount(); i++) {
                 if (parsed.getChild(i) instanceof EJBQLSelectClause) {
@@ -156,24 +155,23 @@ class Compiler {
                         incoming = ((ArcProperty) property).getRelationship();
                         descriptor = ((ArcProperty) property).getTargetDescriptor();
                         pathRelationshipString = buffer.substring(0, buffer.length());
-                        
+
                         descriptorsById.put(pathRelationshipString, descriptor);
                         incomingById.put(pathRelationshipString, incoming);
-                        
+
                     }
                 }
 
-                
                 if (pathsInSelect.size() > 0
                         && incoming != null
                         && pathRelationshipString.length() > 0
                         && pathRelationshipString.equals(buffer.toString())) {
-                    
+
                     EJBQLIdentifier ident = new EJBQLIdentifier(0);
                     ident.text = pathRelationshipString;
-                    
+
                     Integer integer = pathsInSelect.get(path);
-                    if(integer!=null){
+                    if (integer != null) {
                         resultComponents.remove(integer.intValue());
                         resultComponents.add(pathsInSelect.get(path).intValue(), ident);
                         rootId = pathRelationshipString;
@@ -181,9 +179,7 @@ class Compiler {
                 }
             }
         }
-       
-        
-        
+
         CompiledExpression compiled = new CompiledExpression();
         compiled.setExpression(parsed);
         compiled.setSource(source);
@@ -192,7 +188,7 @@ class Compiler {
         compiled.setDescriptorsById(descriptorsById);
         compiled.setIncomingById(incomingById);
         compiled.setPrefetchTree(prefetchTree);
-        
+
         if (resultComponents != null) {
             SQLResult mapping = new SQLResult();
 
@@ -222,26 +218,29 @@ class Compiler {
                         }
                     }
                     mapping.addEntityResult(compileEntityResult);
-                    
+
                 }
             }
 
             compiled.setResult(mapping);
-            
+
         }
 
         return compiled;
     }
 
-    private EntityResult compileEntityResultWithPrefetch(EntityResult compiledResult, EJBQLExpression prefetchExpression){
+    private EntityResult compileEntityResultWithPrefetch(
+            EntityResult compiledResult,
+            EJBQLExpression prefetchExpression) {
         final EntityResult result = compiledResult;
         String id = prefetchExpression.getText().toLowerCase();
         ClassDescriptor descriptor = descriptorsById.get(id);
         if (descriptor == null) {
             descriptor = descriptorsById.get(prefetchExpression.getText());
         }
-        final String prefix = prefetchExpression.getText().substring(prefetchExpression.getText().indexOf(".")+1);
-      
+        final String prefix = prefetchExpression.getText().substring(
+                prefetchExpression.getText().indexOf(".") + 1);
+
         final Set<String> visited = new HashSet<String>();
 
         PropertyVisitor visitor = new PropertyVisitor() {
@@ -249,10 +248,10 @@ class Compiler {
             public boolean visitAttribute(AttributeProperty property) {
                 ObjAttribute oa = property.getAttribute();
                 if (visited.add(oa.getDbAttributePath())) {
-                    result.addObjectField(
-                            oa.getEntity().getName(),
-                            "fetch."+prefix+"."+oa.getName(),
-                            prefix +"."+ oa.getDbAttributeName());
+                    result.addObjectField(oa.getEntity().getName(), "fetch."
+                            + prefix
+                            + "."
+                            + oa.getName(), prefix + "." + oa.getDbAttributeName());
                 }
                 return true;
             }
@@ -268,7 +267,9 @@ class Compiler {
                 for (DbJoin join : dbRel.getJoins()) {
                     DbAttribute src = join.getSource();
                     if (src.isForeignKey() && visited.add(src.getName())) {
-                        result.addDbField("fetch."+prefix+"."+src.getName(), prefix +"."+ src.getName());
+                        result.addDbField("fetch." + prefix + "." + src.getName(), prefix
+                                + "."
+                                + src.getName());
                     }
                 }
 
@@ -281,24 +282,26 @@ class Compiler {
         // append id columns ... (some may have been appended already via relationships)
         for (String pkName : descriptor.getEntity().getPrimaryKeyNames()) {
             if (visited.add(pkName)) {
-                result.addDbField("fetch."+prefix+"."+pkName, prefix +"."+ pkName);
+                result
+                        .addDbField("fetch." + prefix + "." + pkName, prefix
+                                + "."
+                                + pkName);
             }
         }
 
         // append inheritance discriminator columns...
-        Iterator<ObjAttribute> discriminatorColumns = descriptor
-                .getDiscriminatorColumns();
-        while (discriminatorColumns.hasNext()) {
-            ObjAttribute column = discriminatorColumns.next();
+        for (ObjAttribute column : descriptor.getDiscriminatorColumns()) {
 
             if (visited.add(column.getName())) {
-                result.addDbField("fetch."+prefix+"."+column.getDbAttributePath(), prefix +"."+ column.getDbAttributePath());
+                result.addDbField(
+                        "fetch." + prefix + "." + column.getDbAttributePath(),
+                        prefix + "." + column.getDbAttributePath());
             }
         }
 
         return result;
     }
-    
+
     private EntityResult compileEntityResult(EJBQLExpression expression, int position) {
         String id = expression.getText().toLowerCase();
         ClassDescriptor descriptor = descriptorsById.get(id);
@@ -355,10 +358,7 @@ class Compiler {
         }
 
         // append inheritance discriminator columns...
-        Iterator<ObjAttribute> discriminatorColumns = descriptor
-                .getDiscriminatorColumns();
-        while (discriminatorColumns.hasNext()) {
-            ObjAttribute column = discriminatorColumns.next();
+        for (ObjAttribute column : descriptor.getDiscriminatorColumns()) {
 
             if (visited.add(column.getName())) {
                 entityResult.addDbField(column.getDbAttributePath(), prefix + index[0]++);
@@ -458,7 +458,7 @@ class Compiler {
         public boolean visitSubselect(EJBQLExpression expression) {
             return super.visitSubselect(expression);
         }
-        
+
         private void prepareFetchJoin(EJBQLJoin join) {
             if (prefetchTree == null) {
                 prefetchTree = new PrefetchTreeNode();
@@ -609,7 +609,7 @@ class Compiler {
             expression.getChild(0).getChild(0).visit(pathVisitor);
             return false;
         }
-        
+
         @Override
         public boolean visitPath(EJBQLExpression expression, int finishedChildIndex) {
             addPath((EJBQLPath) expression);

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/reflect/ClassDescriptor.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/reflect/ClassDescriptor.java?rev=949719&r1=949718&r2=949719&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/reflect/ClassDescriptor.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/reflect/ClassDescriptor.java Mon May 31 11:25:12 2010
@@ -20,7 +20,6 @@
 package org.apache.cayenne.reflect;
 
 import java.util.Collection;
-import java.util.Iterator;
 
 import org.apache.cayenne.exp.Expression;
 import org.apache.cayenne.map.DbEntity;
@@ -119,11 +118,11 @@ public interface ClassDescriptor {
     Property getDeclaredProperty(String propertyName);
 
     /**
-     * Returns an iterator over the properties mapped to id columns.
+     * Returns a collection of the properties mapped to id columns.
      * 
-     * @since 3.0
+     * @since 3.1
      */
-    Iterator<Property> getIdProperties();
+    Collection<AttributeProperty> getIdProperties();
 
     /**
      * Returns a collection of ObjAttribute for the described class, its superclasses and
@@ -131,9 +130,9 @@ public interface ClassDescriptor {
      * expression specifies a DbAttribute instead of an ObjAttribute, a synthetic
      * ObjAttribute is created and returned.
      * 
-     * @since 3.0
+     * @since 3.1
      */
-    Iterator<ObjAttribute> getDiscriminatorColumns();
+    Collection<ObjAttribute> getDiscriminatorColumns();
 
     /**
      * Returns entity qualifier as a Cayenne expression that includes qualifiers for this
@@ -144,16 +143,16 @@ public interface ClassDescriptor {
     Expression getEntityQualifier();
 
     /**
-     * Returns an iterator over the arc properties whose reverse arcs are to-many maps.
-     * I.e. for each ArcProperty in the iterator, the following is true:
+     * Returns a collection over the arc properties whose reverse arcs are to-many maps.
+     * I.e. for each ArcProperty in returned collection, the following is true:
      * 
      * <pre>
      * arc.getComplimentaryReverseArc() instanceof ToManyMapProperty
      * </pre>
      * 
-     * @since 3.0
+     * @since 3.1
      */
-    Iterator<ArcProperty> getMapArcProperties();
+    Collection<ArcProperty> getMapArcProperties();
 
     /**
      * Passes the visitor to the properties "visit" method for all properties declared in

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/reflect/LazyClassDescriptorDecorator.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/reflect/LazyClassDescriptorDecorator.java?rev=949719&r1=949718&r2=949719&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/reflect/LazyClassDescriptorDecorator.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/reflect/LazyClassDescriptorDecorator.java Mon May 31 11:25:12 2010
@@ -19,7 +19,6 @@
 package org.apache.cayenne.reflect;
 
 import java.util.Collection;
-import java.util.Iterator;
 
 import org.apache.cayenne.exp.Expression;
 import org.apache.cayenne.map.DbEntity;
@@ -93,7 +92,7 @@ public class LazyClassDescriptorDecorato
         checkDescriptorInitialized();
         return descriptor.getEntityInheritanceTree();
     }
-    
+
     public boolean hasSubclasses() {
         checkDescriptorInitialized();
         return descriptor.hasSubclasses();
@@ -115,12 +114,12 @@ public class LazyClassDescriptorDecorato
         return descriptor.getObjectClass();
     }
 
-    public Iterator<Property> getIdProperties() {
+    public Collection<AttributeProperty> getIdProperties() {
         checkDescriptorInitialized();
         return descriptor.getIdProperties();
     }
 
-    public Iterator<ObjAttribute> getDiscriminatorColumns() {
+    public Collection<ObjAttribute> getDiscriminatorColumns() {
         checkDescriptorInitialized();
         return descriptor.getDiscriminatorColumns();
     }
@@ -130,7 +129,7 @@ public class LazyClassDescriptorDecorato
         return descriptor.getEntityQualifier();
     }
 
-    public Iterator<ArcProperty> getMapArcProperties() {
+    public Collection<ArcProperty> getMapArcProperties() {
         checkDescriptorInitialized();
         return descriptor.getMapArcProperties();
     }

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/reflect/PersistentDescriptor.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/reflect/PersistentDescriptor.java?rev=949719&r1=949718&r2=949719&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/reflect/PersistentDescriptor.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/reflect/PersistentDescriptor.java Mon May 31 11:25:12 2010
@@ -20,9 +20,9 @@ package org.apache.cayenne.reflect;
 
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
-import java.util.Iterator;
 import java.util.Map;
 
 import org.apache.cayenne.CayenneRuntimeException;
@@ -33,7 +33,6 @@ import org.apache.cayenne.map.EntityInhe
 import org.apache.cayenne.map.ObjAttribute;
 import org.apache.cayenne.map.ObjEntity;
 import org.apache.cayenne.map.ObjRelationship;
-import org.apache.commons.collections.IteratorUtils;
 
 /**
  * A default ClassDescriptor implementation for persistent objects.
@@ -60,7 +59,7 @@ public class PersistentDescriptor implem
     protected EntityInheritanceTree entityInheritanceTree;
 
     // combines declared and super properties
-    protected Collection<Property> idProperties;
+    protected Collection<AttributeProperty> idProperties;
 
     // combines declared and super properties
     protected Collection<ArcProperty> mapArcProperties;
@@ -116,14 +115,16 @@ public class PersistentDescriptor implem
 
     void indexAddedProperty(Property property) {
         if (property instanceof AttributeProperty) {
-            ObjAttribute attribute = ((AttributeProperty) property).getAttribute();
+
+            AttributeProperty attributeProperty = (AttributeProperty) property;
+            ObjAttribute attribute = attributeProperty.getAttribute();
             if (attribute.isPrimaryKey()) {
 
                 if (idProperties == null) {
-                    idProperties = new ArrayList<Property>(2);
+                    idProperties = new ArrayList<AttributeProperty>(2);
                 }
 
-                idProperties.add(property);
+                idProperties.add(attributeProperty);
             }
         }
         else if (property instanceof ArcProperty) {
@@ -222,28 +223,27 @@ public class PersistentDescriptor implem
         return subclassDescriptor != null ? subclassDescriptor : this;
     }
 
-    public Iterator<ObjAttribute> getDiscriminatorColumns() {
-        return allDiscriminatorColumns != null
-                ? allDiscriminatorColumns.iterator()
-                : IteratorUtils.EMPTY_ITERATOR;
+    public Collection<ObjAttribute> getDiscriminatorColumns() {
+        return allDiscriminatorColumns != null ? allDiscriminatorColumns : Collections
+                .<ObjAttribute> emptyList();
     }
 
-    public Iterator<Property> getIdProperties() {
+    public Collection<AttributeProperty> getIdProperties() {
 
         if (idProperties != null) {
-            return idProperties.iterator();
+            return idProperties;
         }
 
-        return IteratorUtils.EMPTY_ITERATOR;
+        return Collections.emptyList();
     }
 
-    public Iterator<ArcProperty> getMapArcProperties() {
+    public Collection<ArcProperty> getMapArcProperties() {
 
         if (mapArcProperties != null) {
-            return mapArcProperties.iterator();
+            return mapArcProperties;
         }
 
-        return IteratorUtils.EMPTY_ITERATOR;
+        return Collections.EMPTY_LIST;
     }
 
     /**

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/reflect/MockClassDescriptor.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/reflect/MockClassDescriptor.java?rev=949719&r1=949718&r2=949719&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/reflect/MockClassDescriptor.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/reflect/MockClassDescriptor.java Mon May 31 11:25:12 2010
@@ -21,7 +21,6 @@ package org.apache.cayenne.reflect;
 
 import java.util.Collection;
 import java.util.Collections;
-import java.util.Iterator;
 
 import org.apache.cayenne.exp.Expression;
 import org.apache.cayenne.map.DbEntity;
@@ -58,15 +57,15 @@ public class MockClassDescriptor impleme
         return null;
     }
 
-    public Iterator<Property> getIdProperties() {
+    public Collection<AttributeProperty> getIdProperties() {
         return null;
     }
 
-    public Iterator<ObjAttribute> getDiscriminatorColumns() {
+    public Collection<ObjAttribute> getDiscriminatorColumns() {
         return null;
     }
 
-    public Iterator<ArcProperty> getMapArcProperties() {
+    public Collection<ArcProperty> getMapArcProperties() {
         return null;
     }