[webbeans-commits] Webbeans SVN: r2433 - ri/trunk/impl/src/main/java/org/jboss/webbeans/conversation.

webbeans-commits at lists.jboss.org webbeans-commits at lists.jboss.org
Thu Apr 16 10:47:08 EDT 2009


Author: cpopetz
Date: 2009-04-16 10:47:08 -0400 (Thu, 16 Apr 2009)
New Revision: 2433

Modified:
   ri/trunk/impl/src/main/java/org/jboss/webbeans/conversation/ConversationImpl.java
Log:
Override equals/hashcode to use the cid, so that conversations can live in collections.


Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/conversation/ConversationImpl.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/conversation/ConversationImpl.java	2009-04-16 14:27:01 UTC (rev 2432)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/conversation/ConversationImpl.java	2009-04-16 14:47:08 UTC (rev 2433)
@@ -163,4 +163,20 @@
    {
       return originalCid;
    }
+   
+   @Override
+   public boolean equals(Object obj)
+   {
+      
+      if (obj == null || !(obj instanceof Conversation))
+         return false;
+      String otherCid = ((Conversation)obj).getId();
+      return (cid == null || otherCid == null) ? false : cid.equals(otherCid);
+   }
+   
+   @Override
+   public int hashCode()
+   {
+      return cid == null ? super.hashCode() : cid.hashCode();
+   }
 }




More information about the weld-commits mailing list