From 9898c1656694000aa090269e7b9889894cf2f063 Mon Sep 17 00:00:00 2001
From: Matthew Swift <matthew.swift@forgerock.com>
Date: Mon, 07 May 2012 10:20:21 +0000
Subject: [PATCH] Fix OPENDJ-484: Implement equals and hashCode for SDK schema elements

---
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/DITContentRule.java |   27 +++++++++++++++++++++++++++
 1 files changed, 27 insertions(+), 0 deletions(-)

diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/DITContentRule.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/DITContentRule.java
index 4daa04c..06fff35 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/DITContentRule.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/DITContentRule.java
@@ -105,6 +105,27 @@
     }
 
     /**
+     * Returns {@code true} if the provided object is a DIT content rule having
+     * the same structural object class OID as this DIT content rule.
+     *
+     * @param o
+     *            The object to be compared.
+     * @return {@code true} if the provided object is a DIT content rule having
+     *         the same numeric OID as this DIT content rule.
+     */
+    @Override
+    public boolean equals(final Object o) {
+        if (this == o) {
+            return true;
+        } else if (o instanceof DITContentRule) {
+            final DITContentRule other = (DITContentRule) o;
+            return structuralClassOID.equals(other.structuralClassOID);
+        } else {
+            return false;
+        }
+    }
+
+    /**
      * Returns an unmodifiable set containing the auxiliary objectclasses that
      * may be used for entries associated with this DIT content rule.
      *
@@ -191,6 +212,12 @@
         return structuralClassOID;
     }
 
+    /**
+     * Returns the hash code for this DIT content rule. It will be calculated as
+     * the hash code of the structural object class OID.
+     *
+     * @return The hash code for this DIT content rule.
+     */
     @Override
     public int hashCode() {
         return structuralClassOID.hashCode();

--
Gitblit v1.10.0