db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From to...@apache.org
Subject svn commit: r371512 - /db/ojb/trunk/src/java/org/apache/ojb/broker/core/proxy/AbstractCollectionProxy.java
Date Mon, 23 Jan 2006 10:15:30 GMT
Author: tomdz
Date: Mon Jan 23 02:15:23 2006
New Revision: 371512

URL: http://svn.apache.org/viewcvs?rev=371512&view=rev
Log:
Fix for OJB-90

Modified:
    db/ojb/trunk/src/java/org/apache/ojb/broker/core/proxy/AbstractCollectionProxy.java

Modified: db/ojb/trunk/src/java/org/apache/ojb/broker/core/proxy/AbstractCollectionProxy.java
URL: http://svn.apache.org/viewcvs/db/ojb/trunk/src/java/org/apache/ojb/broker/core/proxy/AbstractCollectionProxy.java?rev=371512&r1=371511&r2=371512&view=diff
==============================================================================
--- db/ojb/trunk/src/java/org/apache/ojb/broker/core/proxy/AbstractCollectionProxy.java (original)
+++ db/ojb/trunk/src/java/org/apache/ojb/broker/core/proxy/AbstractCollectionProxy.java Mon
Jan 23 02:15:23 2006
@@ -1,6 +1,6 @@
 package org.apache.ojb.broker.core.proxy;
 
-/* Copyright 2002-2004 The Apache Software Foundation
+/* Copyright 2002-2006 The Apache Software Foundation
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -22,7 +22,6 @@
 import java.util.Collection;
 import java.util.Collections;
 import java.util.Iterator;
-
 import org.apache.ojb.broker.ManageableCollection;
 import org.apache.ojb.broker.OJBRuntimeException;
 import org.apache.ojb.broker.PBFactoryException;
@@ -31,10 +30,10 @@
 import org.apache.ojb.broker.PersistenceBrokerException;
 import org.apache.ojb.broker.PersistenceBrokerInternal;
 import org.apache.ojb.broker.PersistenceConfiguration;
-import org.apache.ojb.broker.metadata.MetadataManager;
-import org.apache.ojb.broker.metadata.MetadataException;
 import org.apache.ojb.broker.accesslayer.CollectionCreationContext;
 import org.apache.ojb.broker.core.PersistenceBrokerThreadMapping;
+import org.apache.ojb.broker.metadata.MetadataException;
+import org.apache.ojb.broker.metadata.MetadataManager;
 import org.apache.ojb.broker.util.collections.TrackingCollection;
 
 /**
@@ -666,5 +665,44 @@
             return Collections.EMPTY_LIST;
         }
     }
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean equals(Object obj)
+    {
+        if (obj instanceof Collection)
+        {
+            Collection ownRealData = getData();
+
+            if (ownRealData == null)
+            {
+                return false;
+            }
+            else if (obj instanceof CollectionProxyDefaultImpl)
+            {
+                Collection otherRealData = ((CollectionProxyDefaultImpl)obj).getData();
     
+                return ownRealData.equals(otherRealData);
+            }
+            else
+            {
+                return ownRealData.equals(obj);
+            }
+        }
+        else
+        {
+            return false;
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public int hashCode()
+    {
+        Collection ownRealData = getData();
+
+        return (ownRealData == null ? super.hashCode() : ownRealData.hashCode());
+    }
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org


Mime
View raw message