KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > portal > core > security > PermissionDescription


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.core.security;
10
11 /**
12  * A permission description.
13  *
14  * @author <a HREF="mailto:julien@jboss.org">Julien Viet</a>
15  * @version $Revision: 1.2 $
16  */

17 public final class PermissionDescription
18 {
19
20    /** Permission name. */
21    private final String JavaDoc name;
22
23    /** Permission description text. */
24    private final String JavaDoc description;
25    
26    public PermissionDescription(String JavaDoc name, String JavaDoc description)
27    {
28       if (name == null)
29       {
30          throw new IllegalArgumentException JavaDoc();
31       }
32       if (description == null)
33       {
34          throw new IllegalArgumentException JavaDoc();
35       }
36       this.name = name;
37       this.description = description;
38    }
39    
40    public String JavaDoc getName()
41    {
42       return name;
43    }
44
45    public String JavaDoc getDescription()
46    {
47       return description;
48    }
49    
50    public boolean equals(Object JavaDoc obj)
51    {
52       if (obj == this)
53       {
54          return true;
55       }
56       if (obj instanceof PermissionDescription)
57       {
58          PermissionDescription other = (PermissionDescription)obj;
59          return other.name.equals(name);
60       }
61       return false;
62    }
63    
64    public int hashCode()
65    {
66       return name.hashCode();
67    }
68 }
69
Popular Tags