KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > jmx > snmp > IPAcl > PermissionImpl


1 /*
2  * @(#)file PermissionImpl.java
3  * @(#)author Sun Microsystems, Inc.
4  * @(#)version 4.10
5  * @(#)date 08/02/09
6  *
7  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
8  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
9  *
10  */

11
12
13 package com.sun.jmx.snmp.IPAcl;
14
15
16
17 import java.io.Serializable JavaDoc;
18
19
20 /**
21  * Permission is represented as a String.
22  *
23  * @see java.security.acl.Permission
24  * @version 4.10 12/19/03
25  * @author Sun Microsystems, Inc
26  */

27
28 class PermissionImpl implements java.security.acl.Permission JavaDoc, Serializable JavaDoc {
29   private String JavaDoc perm = null;
30   
31   /**
32    * Constructs a permission.
33    *
34    * @param s the string representing the permission.
35    */

36   public PermissionImpl(String JavaDoc s) {
37     perm = s;
38   }
39   
40   public int hashCode() {
41     return super.hashCode();
42   }
43   
44   /**
45    * Returns true if the object passed matches the permission represented in.
46    *
47    * @param p the Permission object to compare with.
48    * @return true if the Permission objects are equal, false otherwise.
49    */

50   public boolean equals(Object JavaDoc p){
51     if (p instanceof PermissionImpl){
52       return perm.equals(((PermissionImpl)p).getString());
53     } else {
54       return false;
55     }
56   }
57   
58   /**
59    * Prints a string representation of this permission.
60    *
61    * @return a string representation of this permission.
62    */

63   public String JavaDoc toString(){
64     return perm.toString();
65   }
66   
67   /**
68    * Prints the permission.
69    *
70    * @return a string representation of this permission.
71    */

72   public String JavaDoc getString(){
73     return perm;
74   }
75 }
76
77
Popular Tags