You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-commits@jackrabbit.apache.org by kw...@apache.org on 2021/10/05 13:02:25 UTC

[jackrabbit-oak] branch trunk updated: OAK-9591 - Implement hashcode() and equals() method in ItemDefinitionImpl (#382)

This is an automated email from the ASF dual-hosted git repository.

kwin pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/jackrabbit-oak.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 1235d9f  OAK-9591 - Implement hashcode() and equals() method in ItemDefinitionImpl (#382)
1235d9f is described below

commit 1235d9f24dc26a404b447aef9d6354b45651182c
Author: Ankita Agarwal <an...@gmail.com>
AuthorDate: Tue Oct 5 18:32:01 2021 +0530

    OAK-9591 - Implement hashcode() and equals() method in ItemDefinitionImpl (#382)
---
 .../oak/plugins/nodetype/ItemDefinitionImpl.java       | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/ItemDefinitionImpl.java b/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/ItemDefinitionImpl.java
index 7177828..e592623 100644
--- a/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/ItemDefinitionImpl.java
+++ b/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/ItemDefinitionImpl.java
@@ -27,6 +27,8 @@ import org.apache.jackrabbit.oak.spi.nodetype.NodeTypeConstants;
 
 import static com.google.common.base.Preconditions.checkNotNull;
 
+import java.util.Objects;
+
 /**
  * <pre>
  * [nt:{propertyDefinition,childNodeDefinition}]
@@ -97,4 +99,20 @@ class ItemDefinitionImpl extends AbstractTypeDefinition
         return getName();
     }
 
+    @Override
+    public int hashCode() {
+        return Objects.hash(type);
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj)
+            return true;
+        if (obj == null)
+            return false;
+        if (getClass() != obj.getClass())
+            return false;
+        ItemDefinitionImpl other = (ItemDefinitionImpl) obj;
+        return Objects.equals(type, other.type);
+    }
 }