Methods Summary |
---|
public void | checkGuard(java.lang.Object obj)Invokes {@link SecurityManager#checkPermission(Permission)} with this
permission as its argument. This method implements the {@link Guard}
interface.
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
sm.checkPermission(this);
}
|
public abstract boolean | equals(java.lang.Object obj)Compares the specified object with this {@code Permission} for equality
and returns {@code true} if the specified object is equal, {@code false}
otherwise.
The {@link #implies(Permission)} method should be used for making access
control checks.
|
public abstract java.lang.String | getActions()Returns a comma separated string identifying the actions associated with
this permission. The returned actions are in canonical form. For example:
sp0 = new SocketPermission("www.google.com", "connect,resolve")
sp1 = new SocketPermission("www.google.com", "resolve,connect")
sp0.getActions().equals(sp1.getActions()) //yields true
Both permissions return "connect,resolve" (in that order) if {@code
#getActions()} is invoked. Returns an empty String, if no actions are
associated with this permission.
|
public final java.lang.String | getName()Returns the name of this permission.
return name;
|
public abstract int | hashCode()Returns the hash code value for this {@code Permission}. Returns the same
hash code for {@code Permission}s that are equal to each other as
required by the general contract of {@link Object#hashCode}.
|
public abstract boolean | implies(java.security.Permission permission)Indicates whether the specified permission is implied by this permission.
The {@link AccessController} uses this method to check whether permission
protected access is allowed with the present policy.
|
public java.security.PermissionCollection | newPermissionCollection()Returns a specific {@link PermissionCollection} container for permissions
of this type. Returns {@code null} if any permission collection can be
used.
Subclasses may override this method to return an appropriate collection
for the specific permissions they implement.
return null;
|
public java.lang.String | toString()Returns a string containing a concise, human-readable description of the
this {@code Permission} including its name and its actions.
String actions = getActions();
actions = (actions == null || actions.length() == 0) ? "" : " " //$NON-NLS-1$ //$NON-NLS-2$
+ getActions();
return "(" + getClass().getName() + " " + getName() + actions + ")"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|