You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by mc...@apache.org on 2011/11/03 10:28:13 UTC

svn commit: r1197018 - /commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ObjectIndexedPropertyDescriptor.java

Author: mcucchiara
Date: Thu Nov  3 09:28:13 2011
New Revision: 1197018

URL: http://svn.apache.org/viewvc?rev=1197018&view=rev
Log:
OGNL-37 - Provide equals() and hashcode() implementation to override PropertyDescriptor.

Modified:
    commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ObjectIndexedPropertyDescriptor.java

Modified: commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ObjectIndexedPropertyDescriptor.java
URL: http://svn.apache.org/viewvc/commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ObjectIndexedPropertyDescriptor.java?rev=1197018&r1=1197017&r2=1197018&view=diff
==============================================================================
--- commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ObjectIndexedPropertyDescriptor.java (original)
+++ commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ObjectIndexedPropertyDescriptor.java Thu Nov  3 09:28:13 2011
@@ -118,4 +118,50 @@ public class ObjectIndexedPropertyDescri
     {
         return propertyType;
     }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o)
+        {
+            return true;
+        }
+
+        if (!(o instanceof ObjectIndexedPropertyDescriptor))
+        {
+            return false;
+        }
+
+        if (!super.equals(o))
+        {
+            return false;
+        }
+
+        ObjectIndexedPropertyDescriptor that = (ObjectIndexedPropertyDescriptor) o;
+
+        if (indexedReadMethod != null ? !indexedReadMethod.equals(that.indexedReadMethod) : that.indexedReadMethod != null)
+        {
+            return false;
+        }
+
+        if (indexedWriteMethod != null ? !indexedWriteMethod.equals(that.indexedWriteMethod) : that.indexedWriteMethod != null)
+        {
+            return false;
+        }
+
+        if (propertyType != null ? !propertyType.equals(that.propertyType) : that.propertyType != null)
+        {
+            return false;
+        }
+
+        return true;
+    }
+
+    @Override
+    public int hashCode() {
+        int result = super.hashCode();
+        result = 31 * result + (indexedReadMethod != null ? indexedReadMethod.hashCode() : 0);
+        result = 31 * result + (indexedWriteMethod != null ? indexedWriteMethod.hashCode() : 0);
+        result = 31 * result + (propertyType != null ? propertyType.hashCode() : 0);
+        return result;
+    }
 }