You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mina.apache.org by el...@apache.org on 2011/04/09 15:48:09 UTC

svn commit: r1090594 - /mina/branches/2.0.3/mina-core/src/main/java/org/apache/mina/core/session/AttributeKey.java

Author: elecharny
Date: Sat Apr  9 13:48:09 2011
New Revision: 1090594

URL: http://svn.apache.org/viewvc?rev=1090594&view=rev
Log:
Applied the patch for DIRMINA-815

Modified:
    mina/branches/2.0.3/mina-core/src/main/java/org/apache/mina/core/session/AttributeKey.java

Modified: mina/branches/2.0.3/mina-core/src/main/java/org/apache/mina/core/session/AttributeKey.java
URL: http://svn.apache.org/viewvc/mina/branches/2.0.3/mina-core/src/main/java/org/apache/mina/core/session/AttributeKey.java?rev=1090594&r1=1090593&r2=1090594&view=diff
==============================================================================
--- mina/branches/2.0.3/mina-core/src/main/java/org/apache/mina/core/session/AttributeKey.java (original)
+++ mina/branches/2.0.3/mina-core/src/main/java/org/apache/mina/core/session/AttributeKey.java Sat Apr  9 13:48:09 2011
@@ -52,10 +52,8 @@ public final class AttributeKey implemen
      * <li>this attribute hashCode</li>
      * </ul>
      * 
-     * @param source
-     *            The class this AttributeKey will be attached to
-     * @param name
-     *            The Attribute name
+     * @param source The class this AttributeKey will be attached to
+     * @param name The Attribute name
      */
     public AttributeKey(Class<?> source, String name) {
         this.name = source.getName() + '.' + name + '@' + Integer.toHexString(this.hashCode());
@@ -68,4 +66,25 @@ public final class AttributeKey implemen
     public String toString() {
         return name;
     }
+    
+    @Override
+    public int hashCode() {
+        int h = 17 * 37 + ((name == null) ? 0 : name.hashCode());
+        return h;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+ 
+        if (!(obj instanceof AttributeKey)) {
+            return false;
+        }
+
+        AttributeKey other = (AttributeKey) obj;
+        
+        return name.equals(other.name);
+    }
 }