commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mcucchi...@apache.org
Subject svn commit: r1197018 - /commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ObjectIndexedPropertyDescriptor.java
Date Thu, 03 Nov 2011 09:28:13 GMT
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;
+    }
 }



Mime
View raw message