KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > portal > test > portal > kernel > ServiceIDImpl


1 /*****************************************
2  * *
3  * JBoss Portal: The OpenSource Portal *
4  * *
5  * Distributable under LGPL license. *
6  * See terms of license at gnu.org. *
7  * *
8  *****************************************/

9 package org.jboss.portal.test.portal.kernel;
10
11 import org.jboss.portal.server.kernel.ServiceID;
12
13 /**
14  * @author <a HREF="mailto:julien@jboss.org">Julien Viet</a>
15  * @version $Revision: 1.1.1.1 $
16  */

17 public class ServiceIDImpl implements ServiceID
18 {
19    private final String JavaDoc name;
20
21    public ServiceIDImpl(String JavaDoc name)
22    {
23       if (name == null)
24       {
25          throw new IllegalArgumentException JavaDoc("name must not be null");
26       }
27       this.name = name;
28    }
29
30    public int hashCode()
31    {
32       return name.hashCode();
33    }
34
35    public boolean equals(Object JavaDoc obj)
36    {
37       if (obj == this)
38       {
39          return true;
40       }
41       if (obj instanceof ServiceIDImpl)
42       {
43          return ((ServiceIDImpl)obj).name.equals(name);
44       }
45       return false;
46    }
47
48    public String JavaDoc toString()
49    {
50       return "ServiceID : " + name;
51    }
52 }
53
Popular Tags