1 7 8 package java.security; 9 10 47 48 public abstract class Permission implements Guard , java.io.Serializable { 49 50 private static final long serialVersionUID = -5636570222231596674L; 51 52 private String name; 53 54 60 61 public Permission(String name) { 62 this.name = name; 63 } 64 65 83 public void checkGuard(Object object) throws SecurityException { 84 SecurityManager sm = System.getSecurityManager(); 85 if (sm != null) sm.checkPermission(this); 86 } 87 88 104 105 public abstract boolean implies(Permission permission); 106 107 117 118 public abstract boolean equals(Object obj); 119 120 140 141 public abstract int hashCode(); 142 143 151 152 public final String getName() { 153 return name; 154 } 155 156 175 176 public abstract String getActions(); 177 178 192 193 public PermissionCollection newPermissionCollection() { 194 return null; 195 } 196 197 204 205 public String toString() { 206 String actions = getActions(); 207 if ((actions == null) || (actions.length() == 0)) { return "(" + getClass().getName() + " " + name + ")"; 209 } else { 210 return "(" + getClass().getName() + " " + name + " " + 211 actions + ")"; 212 } 213 } 214 } 215 216 | Popular Tags |