cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amania...@apache.org
Subject svn commit: r602879 - in /cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne: access/trans/ graph/ instrument/
Date Mon, 10 Dec 2007 12:09:40 GMT
Author: amaniatis
Date: Mon Dec 10 04:09:39 2007
New Revision: 602879

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

Modified:
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/trans/SelectTranslator.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/graph/CompoundDiff.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/graph/GraphManager.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/graph/NodeDiff.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/instrument/CayenneInstrumentationFactory.java

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/trans/SelectTranslator.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/trans/SelectTranslator.java?rev=602879&r1=602878&r2=602879&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/trans/SelectTranslator.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/trans/SelectTranslator.java
Mon Dec 10 04:09:39 2007
@@ -411,9 +411,7 @@
                         dbRelationshipAdded(relationship);
                     }
 
-                    Iterator joins = relationship.getJoins().iterator();
-                    while (joins.hasNext()) {
-                        DbJoin j = (DbJoin) joins.next();
+                    for (DbJoin j : relationship.getJoins()) {
 
                         DbAttribute attribute = relationship.isToMany()
                                 ? j.getTarget()

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/graph/CompoundDiff.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/graph/CompoundDiff.java?rev=602879&r1=602878&r2=602879&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/graph/CompoundDiff.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/graph/CompoundDiff.java
Mon Dec 10 04:09:39 2007
@@ -22,7 +22,6 @@
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
-import java.util.Iterator;
 import java.util.List;
 import java.util.ListIterator;
 
@@ -34,7 +33,7 @@
  */
 public class CompoundDiff implements GraphDiff {
 
-    protected List diffs;
+    protected List<GraphDiff> diffs;
 
     /**
      * Creates an empty CompoundDiff instance.
@@ -46,7 +45,7 @@
      * Creates CompoundDiff instance. Note that a List is not cloned in this constructor,
      * so subsequent calls to add and addAll would modify the original list.
      */
-    public CompoundDiff(List diffs) {
+    public CompoundDiff(List<GraphDiff> diffs) {
         this.diffs = diffs;
     }
 
@@ -58,17 +57,15 @@
             return true;
         }
 
-        Iterator it = diffs.iterator();
-        while (it.hasNext()) {
-            if (!((GraphDiff) it.next()).isNoop()) {
+        for (GraphDiff diff : diffs) {
+            if (! diff.isNoop()) {
                 return false;
             }
         }
-
         return true;
     }
 
-    public List getDiffs() {
+    public List<GraphDiff> getDiffs() {
         return (diffs != null)
                 ? Collections.unmodifiableList(diffs)
                 : Collections.EMPTY_LIST;
@@ -78,7 +75,7 @@
         nonNullDiffs().add(diff);
     }
 
-    public void addAll(Collection diffs) {
+    public void addAll(Collection<GraphDiff> diffs) {
         nonNullDiffs().addAll(diffs);
     }
 
@@ -91,9 +88,7 @@
         }
 
         // implements a naive linear commit - simply replay stored operations
-        Iterator it = diffs.iterator();
-        while (it.hasNext()) {
-            GraphDiff change = (GraphDiff) it.next();
+        for (GraphDiff change : diffs) {
             change.apply(tracker);
         }
     }
@@ -106,18 +101,18 @@
             return;
         }
 
-        ListIterator it = diffs.listIterator(diffs.size());
+        ListIterator<GraphDiff> it = diffs.listIterator(diffs.size());
         while (it.hasPrevious()) {
-            GraphDiff change = (GraphDiff) it.previous();
+            GraphDiff change = it.previous();
             change.undo(tracker);
         }
     }
 
-    List nonNullDiffs() {
+    List<GraphDiff> nonNullDiffs() {
         if (diffs == null) {
             synchronized (this) {
                 if (diffs == null) {
-                    diffs = new ArrayList();
+                    diffs = new ArrayList<GraphDiff>();
                 }
             }
         }

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/graph/GraphManager.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/graph/GraphManager.java?rev=602879&r1=602878&r2=602879&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/graph/GraphManager.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/graph/GraphManager.java
Mon Dec 10 04:09:39 2007
@@ -37,7 +37,7 @@
     Object getNode(Object nodeId);
 
     /**
-     * "Registers" a graph node, usually striong the node in some internal map using its
+     * "Registers" a graph node, usually storing the node in some internal map using its
      * id as a key.
      */
     void registerNode(Object nodeId, Object nodeObject);
@@ -48,7 +48,7 @@
     Object unregisterNode(Object nodeId);
 
     /**
-     * Returns all graph nodes regsitered with GraphManager.
+     * Returns all graph nodes registered with GraphManager.
      */
     Collection registeredNodes();
 }

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/graph/NodeDiff.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/graph/NodeDiff.java?rev=602879&r1=602878&r2=602879&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/graph/NodeDiff.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/graph/NodeDiff.java
Mon Dec 10 04:09:39 2007
@@ -25,7 +25,7 @@
  * @since 1.2
  * @author Andrus Adamchik
  */
-public abstract class NodeDiff implements GraphDiff, Comparable {
+public abstract class NodeDiff implements GraphDiff, Comparable<NodeDiff> {
 
     protected int diffId;
     protected Object nodeId;
@@ -70,11 +70,7 @@
     /**
      * Implements a Comparable interface method to compare based on diffId property.
      */
-    public int compareTo(Object o) {
-        if (!(o instanceof NodeDiff)) {
-            throw new IllegalArgumentException("Can't compare to " + o);
-        }
-
-        return diffId - ((NodeDiff) o).getDiffId();
+    public int compareTo(NodeDiff o) {
+        return diffId - o.getDiffId();
     }
 }

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/instrument/CayenneInstrumentationFactory.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/instrument/CayenneInstrumentationFactory.java?rev=602879&r1=602878&r2=602879&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/instrument/CayenneInstrumentationFactory.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/instrument/CayenneInstrumentationFactory.java
Mon Dec 10 04:09:39 2007
@@ -33,7 +33,7 @@
 
     public Instrumentation getInstrumentation() {
         try {
-            Class agent = Class.forName(AGENT_CLASS, false, Thread
+            Class<?> agent = Class.forName(AGENT_CLASS, false, Thread
                     .currentThread()
                     .getContextClassLoader());
 



Mime
View raw message