directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r491286 - /directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/name/AttributeTypeAndValue.java
Date Sat, 30 Dec 2006 18:37:49 GMT
Author: elecharny
Date: Sat Dec 30 10:37:48 2006
New Revision: 491286

URL: http://svn.apache.org/viewvc?view=rev&rev=491286
Log:
Added an equals() method to superseed the Object.equals() standard method

Modified:
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/name/AttributeTypeAndValue.java

Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/name/AttributeTypeAndValue.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/name/AttributeTypeAndValue.java?view=diff&rev=491286&r1=491285&r2=491286
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/name/AttributeTypeAndValue.java
(original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/name/AttributeTypeAndValue.java
Sat Dec 30 10:37:48 2006
@@ -553,6 +553,49 @@
         return result;
     }
 
+    /**
+     * @see Object#equals(Object)
+     */
+    public boolean equals( Object obj )
+    {
+        if ( this == obj )
+        {
+            return true;
+        }
+        
+        if ( obj == null)
+        {
+            return false;
+        }
+        
+        if ( obj.getClass() != this.getClass() )
+        {
+            return false;
+        }
+        
+        AttributeTypeAndValue instance = (AttributeTypeAndValue)obj;
+     
+        // Compare the type
+        if ( this.type == null )
+        {
+            if ( instance.type != null )
+            {
+                return false;
+            }
+        }
+        else 
+        {
+            if ( !this.type.equals( instance.type ) )
+            {
+                return false;
+            }
+        }
+            
+        // Compare the value
+        return ( this.value == null ? 
+            instance.value == null  :
+            this.type.equals( instance.type ) );
+    }
 
     /**
      * A String representation of a AttributeTypeAndValue.



Mime
View raw message