cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject svn commit: r596974 - in /cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src: main/java/org/apache/cayenne/ main/java/org/apache/cayenne/access/ main/java/org/apache/cayenne/map/ main/java/org/apache/cayenne/remote/hessian/ test/java/org/apach...
Date Wed, 21 Nov 2007 07:52:14 GMT
Author: aadamchik
Date: Tue Nov 20 23:52:09 2007
New Revision: 596974

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

Modified:
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/CayenneContext.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/CayenneContextGraphAction.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/DataObjectUtils.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/DataRow.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/ObjectContextChangeLog.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/ObjectContextDeleteAction.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/ObjectId.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/DataContext.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/remote/hessian/DataRowDeserializer.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/DataRowTest.java

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/CayenneContext.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/CayenneContext.java?rev=596974&r1=596973&r2=596974&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/CayenneContext.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/CayenneContext.java
Tue Nov 20 23:52:09 2007
@@ -221,7 +221,7 @@
             if (graphManager.hasChanges()) {
 
                 ValidationResult result = new ValidationResult();
-                Iterator it = graphManager.dirtyNodes().iterator();
+                Iterator<?> it = graphManager.dirtyNodes().iterator();
                 while (it.hasNext()) {
                     Persistent p = (Persistent) it.next();
                     if (p instanceof Validating) {

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/CayenneContextGraphAction.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/CayenneContextGraphAction.java?rev=596974&r1=596973&r2=596974&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/CayenneContextGraphAction.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/CayenneContextGraphAction.java
Tue Nov 20 23:52:09 2007
@@ -35,11 +35,12 @@
  */
 class CayenneContextGraphAction extends ObjectContextGraphAction {
 
-    ThreadLocal arcChangeInProcess;
+    ThreadLocal<Boolean> arcChangeInProcess;
 
     CayenneContextGraphAction(ObjectContext context) {
         super(context);
-        this.arcChangeInProcess = new ThreadLocal();
+        this.arcChangeInProcess = new ThreadLocal<Boolean>();
+        this.arcChangeInProcess.set(Boolean.FALSE);
     }
 
     protected void handleArcPropertyChange(
@@ -99,7 +100,7 @@
      * This method is used to prevent cycles when setting reverse relationships.
      */
     boolean isArchChangeInProcess() {
-        return arcChangeInProcess.get() != null;
+        return arcChangeInProcess.get();
     }
 
     /**
@@ -108,7 +109,7 @@
      * relationships.
      */
     void setArcChangeInProcess(boolean flag) {
-        arcChangeInProcess.set(flag ? Boolean.TRUE : null);
+        arcChangeInProcess.set(flag);
     }
 
     private void setReverse(

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/DataObjectUtils.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/DataObjectUtils.java?rev=596974&r1=596973&r2=596974&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/DataObjectUtils.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/DataObjectUtils.java
Tue Nov 20 23:52:09 2007
@@ -68,7 +68,7 @@
      * thrown.
      */
     public static Object pkForObject(Persistent dataObject) {
-        Map pk = extractObjectId(dataObject);
+        Map<String, Object> pk = extractObjectId(dataObject);
 
         if (pk.size() != 1) {
             throw new CayenneRuntimeException("Expected single column PK, got "
@@ -77,8 +77,7 @@
                     + pk);
         }
 
-        Map.Entry pkEntry = (Map.Entry) pk.entrySet().iterator().next();
-        return pkEntry.getValue();
+        return pk.entrySet().iterator().next().getValue();
     }
 
     /**
@@ -86,11 +85,11 @@
      * out of all methods for primary key retrieval. It will work for all possible types
      * of primary keys. If an object is transient, an exception is thrown.
      */
-    public static Map compoundPKForObject(Persistent dataObject) {
+    public static Map<String, Object> compoundPKForObject(Persistent dataObject) {
         return Collections.unmodifiableMap(extractObjectId(dataObject));
     }
 
-    static Map extractObjectId(Persistent dataObject) {
+    static Map<String, Object> extractObjectId(Persistent dataObject) {
         if (dataObject == null) {
             throw new IllegalArgumentException("Null DataObject");
         }
@@ -255,7 +254,7 @@
      * @since 1.2
      */
     public static Object objectForQuery(ObjectContext context, Query query) {
-        List objects = context.performQuery(query);
+        List<?> objects = context.performQuery(query);
 
         if (objects.size() == 0) {
             return null;

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/DataRow.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/DataRow.java?rev=596974&r1=596973&r2=596974&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/DataRow.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/DataRow.java
Tue Nov 20 23:52:09 2007
@@ -21,7 +21,6 @@
 
 import java.util.Collection;
 import java.util.HashMap;
-import java.util.Iterator;
 import java.util.Map;
 
 import org.apache.cayenne.map.DbAttribute;
@@ -39,7 +38,7 @@
  * @author Andrus Adamchik
  * @since 1.1
  */
-public class DataRow extends HashMap {
+public class DataRow extends HashMap<String, Object> {
 
     // "volatile" is supposed to ensure consistency in read and increment operations;
     // is this universally true?
@@ -50,7 +49,7 @@
     protected long version = currentVersion++;
     protected long replacesVersion = DataObject.DEFAULT_VERSION;
 
-    public DataRow(Map map) {
+    public DataRow(Map<String, ? extends Object> map) {
         super(map);
     }
 
@@ -80,9 +79,7 @@
     public DataRow applyDiff(DataRow diff) {
         DataRow merged = new DataRow(this);
 
-        Iterator it = diff.entrySet().iterator();
-        while (it.hasNext()) {
-            Map.Entry entry = (Map.Entry) it.next();
+        for (Map.Entry<String, Object> entry : diff.entrySet()) {
             merged.put(entry.getKey(), entry.getValue());
         }
 
@@ -101,11 +98,9 @@
         // build a diff...
         DataRow diff = null;
 
-        Iterator entries = entrySet().iterator();
-        while (entries.hasNext()) {
-            Map.Entry entry = (Map.Entry) entries.next();
+        for (Map.Entry<String, Object> entry : entrySet()) {
 
-            Object key = entry.getKey();
+            String key = entry.getKey();
             Object currentValue = entry.getValue();
             Object rowValue = row.get(key);
 
@@ -123,13 +118,16 @@
     /**
      * Creates an ObjectId from the values in the snapshot. If needed attributes are
      * missing in a snapshot, CayenneRuntimeException is thrown.
+     * 
+     * @deprecated since 3.0 - unused
      */
-    // TODO: andrus, 5/25/2006 - deprecate this method - it is unused
     public ObjectId createObjectId(ObjEntity entity) {
         return createObjectId(entity.getName(), entity.getDbEntity());
     }
 
-    // TODO: andrus, 5/25/2006 - deprecate this method - it is unused
+    /**
+     * @deprecated since 3.0 - unused.
+     */
     public ObjectId createObjectId(String entityName, DbEntity entity) {
         return createObjectId(entityName, entity, null);
     }
@@ -145,7 +143,7 @@
             throw new CayenneRuntimeException("Only 'to one' can have a target ObjectId.");
         }
 
-        Map target = relationship.targetPkSnapshotWithSrcSnapshot(this);
+        Map<String, Object> target = relationship.targetPkSnapshotWithSrcSnapshot(this);
         return (target != null) ? new ObjectId(entityName, target) : null;
     }
 
@@ -159,8 +157,8 @@
      * </p>
      * 
      * @since 1.2
+     * @deprecated since 3.0 - unused.
      */
-    // TODO: andrus, 5/25/2006 - deprecate this method - it is unused
     public ObjectId createObjectId(String entityName, DbEntity entity, String namePrefix)
{
 
         boolean prefix = namePrefix != null && namePrefix.length() > 0;
@@ -191,7 +189,7 @@
 
         // ... handle generic case - PK.size > 1
 
-        Map idMap = new HashMap(pk.size() * 2);
+        Map<String, Object> idMap = new HashMap<String, Object>(pk.size() * 2);
         for (DbAttribute attribute : pk) {
             String key = (prefix) ? namePrefix + attribute.getName() : attribute
                     .getName();

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/ObjectContextChangeLog.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/ObjectContextChangeLog.java?rev=596974&r1=596973&r2=596974&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/ObjectContextChangeLog.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/ObjectContextChangeLog.java
Tue Nov 20 23:52:09 2007
@@ -44,15 +44,15 @@
  */
 class ObjectContextChangeLog {
 
-    List diffs;
-    Map markers;
+    List<GraphDiff> diffs;
+    Map<String, Integer> markers;
 
     ObjectContextChangeLog() {
         reset();
     }
 
     void unregisterNode(Object nodeId) {
-        Iterator it = diffs.iterator();
+        Iterator<?> it = diffs.iterator();
         while (it.hasNext()) {
             Object next = it.next();
 
@@ -76,7 +76,7 @@
     }
 
     void setMarker(String markerTag) {
-        markers.put(markerTag, new Integer(diffs.size()));
+        markers.put(markerTag, diffs.size());
     }
 
     void removeMarker(String markerTag) {
@@ -113,8 +113,8 @@
         // must create a new list instead of clearing an existing one, as the original
         // list may have been exposed via events or "getDiffs", and trimming it is
         // undesirable.
-        this.diffs = new ArrayList();
-        this.markers = new HashMap();
+        this.diffs = new ArrayList<GraphDiff>();
+        this.markers = new HashMap<String, Integer>();
     }
 
     int size() {
@@ -144,7 +144,7 @@
      * Returns a sublist of the diffs list that shouldn't change when OperationRecorder is
      * cleared or new operations are added.
      */
-    private List immutableList(int fromIndex, int toIndex) {
+    private List<GraphDiff> immutableList(int fromIndex, int toIndex) {
         if (toIndex - fromIndex == 0) {
             return Collections.EMPTY_LIST;
         }
@@ -156,13 +156,13 @@
 
     // moded Sublist from JDK that doesn't check for co-modification, as the underlying
     // list is guaranteed to only grow and never shrink or be replaced.
-    static class SubList extends AbstractList implements Serializable {
+    static class SubList extends AbstractList<GraphDiff> implements Serializable {
 
-        private List list;
+        private List<GraphDiff> list;
         private int offset;
         private int size;
 
-        SubList(List list, int fromIndex, int toIndex) {
+        SubList(List<GraphDiff> list, int fromIndex, int toIndex) {
             if (fromIndex < 0)
                 throw new IndexOutOfBoundsException("fromIndex = " + fromIndex);
             if (toIndex > list.size()) {
@@ -180,7 +180,7 @@
             size = toIndex - fromIndex;
         }
 
-        public Object get(int index) {
+        public GraphDiff get(int index) {
             rangeCheck(index);
             return list.get(index + offset);
         }
@@ -197,8 +197,7 @@
 
         // serialization method...
         private Object writeReplace() throws ObjectStreamException {
-            return new ArrayList(list.subList(offset, offset + size));
+            return new ArrayList<GraphDiff>(list.subList(offset, offset + size));
         }
     }
-
 }

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/ObjectContextDeleteAction.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/ObjectContextDeleteAction.java?rev=596974&r1=596973&r2=596974&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/ObjectContextDeleteAction.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/ObjectContextDeleteAction.java
Tue Nov 20 23:52:09 2007
@@ -135,7 +135,7 @@
             return;
         }
 
-        Collection relatedObjects = relatedObjects(object, property);
+        Collection<?> relatedObjects = relatedObjects(object, property);
         if (relatedObjects.isEmpty()) {
             return;
         }
@@ -155,9 +155,7 @@
                 if (reverseArc != null) {
 
                     if (reverseArc instanceof ToManyProperty) {
-                        Iterator iterator = relatedObjects.iterator();
-                        while (iterator.hasNext()) {
-                            Object relatedObject = iterator.next();
+                        for (Object relatedObject : relatedObjects) {
                             ((ToManyProperty) reverseArc).removeTarget(
                                     relatedObject,
                                     object,
@@ -165,9 +163,7 @@
                         }
                     }
                     else {
-                        Iterator iterator = relatedObjects.iterator();
-                        while (iterator.hasNext()) {
-                            Object relatedObject = iterator.next();
+                        for (Object relatedObject : relatedObjects) {
                             ((ToOneProperty) reverseArc).setTarget(
                                     relatedObject,
                                     null,
@@ -179,7 +175,7 @@
                 break;
             case DeleteRule.CASCADE:
 
-                Iterator iterator = relatedObjects.iterator();
+                Iterator<?> iterator = relatedObjects.iterator();
                 while (iterator.hasNext()) {
                     Persistent relatedObject = (Persistent) iterator.next();
 
@@ -195,7 +191,7 @@
         }
     }
 
-    private Collection relatedObjects(Object object, Property property) {
+    private Collection<?> relatedObjects(Object object, Property property) {
         Object related = property.readProperty(object);
 
         if (related == null) {
@@ -204,10 +200,12 @@
         // return collections by copy, to allow removal of objects from the underlying
         // relationship inside the iterator
         else if (property instanceof ToManyProperty) {
-            Collection relatedCollection = (Collection) related;
-            return relatedCollection.isEmpty() ? Collections.EMPTY_LIST : new ArrayList(
-                    relatedCollection);
+            Collection<?> relatedCollection = (Collection<?>) related;
+            return relatedCollection.isEmpty()
+                    ? Collections.EMPTY_LIST
+                    : new ArrayList<Object>(relatedCollection);
         }
+        // TODO: andrus 11/21/2007 - ToManyMapProperty check
         else {
             return Collections.singleton(related);
         }

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/ObjectId.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/ObjectId.java?rev=596974&r1=596973&r2=596974&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/ObjectId.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/ObjectId.java
Tue Nov 20 23:52:09 2007
@@ -147,7 +147,7 @@
      * For temporary id returns replacement id, if it was already created. Otherwise
      * returns an empty map.
      */
-    public Map<String, ?> getIdSnapshot() {
+    public Map<String, Object> getIdSnapshot() {
         if (isTemporary()) {
             return (replacementIdMap == null) ? Collections.EMPTY_MAP : Collections
                     .unmodifiableMap(replacementIdMap);

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/DataContext.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/DataContext.java?rev=596974&r1=596973&r2=596974&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/DataContext.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/DataContext.java
Tue Nov 20 23:52:09 2007
@@ -105,8 +105,7 @@
      * 
      * @since 1.1
      */
-    // TODO: Andrus, 11/7/2005 - should we use InheritableThreadLocal instead?
-    protected static final ThreadLocal threadDataContext = new ThreadLocal();
+    protected static final ThreadLocal<DataContext> threadDataContext = new ThreadLocal<DataContext>();
 
     // Set of DataContextDelegates to be notified.
     private DataContextDelegate delegate;
@@ -149,7 +148,7 @@
      * @see org.apache.cayenne.conf.WebApplicationContextFilter
      */
     public static DataContext getThreadDataContext() throws IllegalStateException {
-        DataContext dc = (DataContext) threadDataContext.get();
+        DataContext dc = threadDataContext.get();
         if (dc == null) {
             throw new IllegalStateException("Current thread has no bound DataContext.");
         }
@@ -309,9 +308,9 @@
         // pass it in constructor.
         ObjectStore objectStore = new ObjectStore();
 
-        DataContext child = factory != null ? factory
-                .createDataContext(this, objectStore) : new DataContext(
-                this, objectStore);
+        DataContext child = factory != null
+                ? factory.createDataContext(this, objectStore)
+                : new DataContext(this, objectStore);
 
         child.setValidatingObjectsOnCommit(isValidatingObjectsOnCommit());
         child.usingSharedSnaphsotCache = isUsingSharedSnapshotCache();
@@ -369,7 +368,7 @@
                     // guarantee that a new channel uses the same EventManager.
                     EventUtil.listenForChannelEvents(channel, mergeHandler);
                 }
-                
+
                 if (!usingSharedSnaphsotCache && getObjectStore() != null) {
                     DataRowStore cache = getObjectStore().getDataRowCache();
 
@@ -581,11 +580,8 @@
                                         + ". Object may have been deleted externally.");
                     }
 
-                    DbRelationship dbRel = (DbRelationship) rel.getDbRelationships().get(
-                            0);
-                    Iterator joins = dbRel.getJoins().iterator();
-                    while (joins.hasNext()) {
-                        DbJoin join = (DbJoin) joins.next();
+                    DbRelationship dbRel = rel.getDbRelationships().get(0);
+                    for (DbJoin join : dbRel.getJoins()) {
                         String key = join.getSourceName();
                         snapshot.put(key, storedSnapshot.get(key));
                     }
@@ -616,14 +612,12 @@
         // we should ignore any object id values if a corresponding attribute
         // is a part of relationship "toMasterPK", since those values have been
         // set above when db relationships where processed.
-        Map thisIdParts = object.getObjectId().getIdSnapshot();
+        Map<String, Object> thisIdParts = object.getObjectId().getIdSnapshot();
         if (thisIdParts != null) {
 
             // put only those that do not exist in the map
-            Iterator idIterator = thisIdParts.entrySet().iterator();
-            while (idIterator.hasNext()) {
-                Map.Entry entry = (Map.Entry) idIterator.next();
-                Object nextKey = entry.getKey();
+            for (Map.Entry<String, Object> entry : thisIdParts.entrySet()) {
+                String nextKey = entry.getKey();
                 if (!snapshot.containsKey(nextKey)) {
                     snapshot.put(nextKey, entry.getValue());
                 }
@@ -692,9 +686,10 @@
                 true);
         return (DataObject) list.get(0);
     }
-    
+
     /**
-     * Creates a DataObject from DataRow. This variety of the 'objectFromDataRow' method
is normally used for generic classes.
+     * Creates a DataObject from DataRow. This variety of the 'objectFromDataRow' method
+     * is normally used for generic classes.
      * 
      * @see DataRow
      * @since 3.0
@@ -1383,7 +1378,10 @@
      *            is required in case a query uses caching.
      * @since 1.1
      */
-    public List<?> performQuery(String queryName, Map parameters, boolean expireCachedLists)
{
+    public List<?> performQuery(
+            String queryName,
+            Map parameters,
+            boolean expireCachedLists) {
         NamedQuery query = new NamedQuery(queryName, parameters);
         query.setForceNoCache(expireCachedLists);
         return performQuery(query);

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=596974&r1=596973&r2=596974&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 23:52:09 2007
@@ -333,14 +333,14 @@
      * CayenneRuntimeException if relationship is "to many" or if snapshot is missing id
      * components.
      */
-    public Map targetPkSnapshotWithSrcSnapshot(Map srcSnapshot) {
+    public Map<String, Object> targetPkSnapshotWithSrcSnapshot(Map<String, Object>
srcSnapshot) {
 
         if (isToMany()) {
             throw new CayenneRuntimeException(
                     "Only 'to one' relationships support this method.");
         }
 
-        Map idMap;
+        Map<String, Object> idMap;
 
         int numJoins = joins.size();
         int foundNulls = 0;
@@ -359,7 +359,7 @@
         }
         // handle generic case: numJoins > 1
         else {
-            idMap = new HashMap(numJoins * 2);
+            idMap = new HashMap<String, Object>(numJoins * 2);
             for (int i = 0; i < numJoins; i++) {
                 DbJoin join = (DbJoin) joins.get(i);
                 DbAttribute source = join.getSource();

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/remote/hessian/DataRowDeserializer.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/remote/hessian/DataRowDeserializer.java?rev=596974&r1=596973&r2=596974&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/remote/hessian/DataRowDeserializer.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/remote/hessian/DataRowDeserializer.java
Tue Nov 20 23:52:09 2007
@@ -51,7 +51,7 @@
         versionField.setAccessible(true);
     }
 
-    public Class getType() {
+    public Class<?> getType() {
         return DataRow.class;
     }
 
@@ -70,7 +70,7 @@
         in.addRef(row);
 
         while (!in.isEnd()) {
-            row.put(in.readObject(), in.readObject());
+            row.put((String) in.readObject(), in.readObject());
         }
 
         in.readEnd();

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/DataRowTest.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/DataRowTest.java?rev=596974&r1=596973&r2=596974&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/DataRowTest.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/DataRowTest.java
Tue Nov 20 23:52:09 2007
@@ -63,6 +63,9 @@
         assertFalse(s3.getVersion() == s1.getVersion());
     }
 
+    /**
+     * @deprecated since 3.0 - unused.
+     */
     public void testCreateObjectId() throws Exception {
         // must provide a map container for the entities
         DataMap entityContainer = new DataMap();
@@ -78,7 +81,7 @@
         at.setPrimaryKey(true);
         dbe.addAttribute(at);
 
-        Class entityClass = Number.class;
+        Class<?> entityClass = Number.class;
         objEntity.setClassName(entityClass.getName());
 
         // test same id created by different methods
@@ -94,6 +97,9 @@
         assertEquals(ref, oid);
     }
 
+    /**
+     * @deprecated since 3.0 - unused.
+     */
     public void testCreateObjectIdNulls() throws Exception {
         // must provide a map container for the entities
         DataMap entityContainer = new DataMap();



Mime
View raw message