KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > jms > serverless > GroupTopic


1 /*
2  * JBoss, the OpenSource J2EE webOS
3  *
4  * Distributable under LGPL license.
5  * See terms of license at gnu.org.
6  */

7 package org.jboss.jms.serverless;
8
9 import org.jboss.logging.Logger;
10 import javax.jms.Topic JavaDoc;
11 import javax.jms.JMSException JavaDoc;
12
13
14 /**
15  * @author Ovidiu Feodorov <ovidiu@jboss.org>
16  * @version $Revision: 1.1 $ $Date: 2004/04/15 22:54:19 $
17  *
18  **/

19 public class GroupTopic implements Topic JavaDoc {
20
21     private static final Logger log = Logger.getLogger(GroupTopic.class);
22
23     private String JavaDoc name;
24
25     public GroupTopic(String JavaDoc name) {
26         this.name = name;
27     }
28
29     public String JavaDoc getTopicName() throws JMSException JavaDoc {
30         return name;
31     }
32
33     public String JavaDoc toString() {
34         try {
35             return Destinations.stringRepresentation(this);
36         }
37         catch(JMSException JavaDoc e) {
38             return "Invalid GroupTopic";
39         }
40     }
41
42     public boolean equals(Object JavaDoc o) {
43        
44         if (this == o) {
45             return true;
46         }
47         if (!(o instanceof GroupTopic)) {
48             return false;
49         }
50
51         GroupTopic that = (GroupTopic)o;
52
53         if (name == null) {
54             return false;
55         }
56         return name.equals(that.name);
57     }
58
59     public int hashCode() {
60
61         // TO_DO: review this
62

63         if (name == null) {
64             return 0;
65         }
66         return name.hashCode();
67     }
68
69 }
70
Popular Tags