java.security
Class BasicPermission

java.lang.Object sample code for java.lang.Object definition code for java.lang.Object 
  extended by java.security.Permission sample code for java.security.Permission definition code for java.security.Permission 
      extended by java.security.BasicPermission
All Implemented Interfaces:
Serializable sample code for java.io.Serializable definition code for java.io.Serializable , Guard sample code for java.security.Guard definition code for java.security.Guard
Direct Known Subclasses:
AudioPermission sample code for javax.sound.sampled.AudioPermission definition code for javax.sound.sampled.AudioPermission , AuthPermission sample code for javax.security.auth.AuthPermission definition code for javax.security.auth.AuthPermission , AWTPermission sample code for java.awt.AWTPermission definition code for java.awt.AWTPermission , DelegationPermission sample code for javax.security.auth.kerberos.DelegationPermission definition code for javax.security.auth.kerberos.DelegationPermission , LoggingPermission sample code for java.util.logging.LoggingPermission definition code for java.util.logging.LoggingPermission , ManagementPermission sample code for java.lang.management.ManagementPermission definition code for java.lang.management.ManagementPermission , MBeanServerPermission sample code for javax.management.MBeanServerPermission definition code for javax.management.MBeanServerPermission , MBeanTrustPermission sample code for javax.management.MBeanTrustPermission definition code for javax.management.MBeanTrustPermission , NetPermission sample code for java.net.NetPermission definition code for java.net.NetPermission , PropertyPermission sample code for java.util.PropertyPermission definition code for java.util.PropertyPermission , ReflectPermission sample code for java.lang.reflect.ReflectPermission definition code for java.lang.reflect.ReflectPermission , RuntimePermission sample code for java.lang.RuntimePermission definition code for java.lang.RuntimePermission , SecurityPermission sample code for java.security.SecurityPermission definition code for java.security.SecurityPermission , SerializablePermission sample code for java.io.SerializablePermission definition code for java.io.SerializablePermission , SQLPermission sample code for java.sql.SQLPermission definition code for java.sql.SQLPermission , SubjectDelegationPermission sample code for javax.management.remote.SubjectDelegationPermission definition code for javax.management.remote.SubjectDelegationPermission

public abstract class BasicPermission
extends Permission sample code for java.security.Permission definition code for java.security.Permission
implements Serializable sample code for java.io.Serializable definition code for java.io.Serializable

The BasicPermission class extends the Permission class, and can be used as the base class for permissions that want to follow the same naming convention as BasicPermission.

The name for a BasicPermission is the name of the given permission (for example, "exit", "setFactory", "print.queueJob", etc). The naming convention follows the hierarchical property naming convention. An asterisk may appear by itself, or if immediately preceded by a "." may appear at the end of the name, to signify a wildcard match. For example, "*" and "java.*" are valid, while "*java", "a*b", and "java*" are not valid.

The action string (inherited from Permission) is unused. Thus, BasicPermission is commonly used as the base class for "named" permissions (ones that contain a name but no actions list; you either have the named permission or you don't.) Subclasses may implement actions on top of BasicPermission, if desired.

See Also:
Permission sample code for java.security.Permission definition code for java.security.Permission , Permissions sample code for java.security.Permissions definition code for java.security.Permissions , PermissionCollection sample code for java.security.PermissionCollection definition code for java.security.PermissionCollection , RuntimePermission sample code for java.lang.RuntimePermission definition code for java.lang.RuntimePermission , SecurityPermission sample code for java.security.SecurityPermission definition code for java.security.SecurityPermission , PropertyPermission sample code for java.util.PropertyPermission definition code for java.util.PropertyPermission , AWTPermission sample code for java.awt.AWTPermission definition code for java.awt.AWTPermission , NetPermission sample code for java.net.NetPermission definition code for java.net.NetPermission , SecurityManager sample code for java.lang.SecurityManager definition code for java.lang.SecurityManager , Serialized Form

Constructor Summary
BasicPermission sample code for java.security.BasicPermission.BasicPermission(java.lang.String) definition code for java.security.BasicPermission.BasicPermission(java.lang.String) (String sample code for java.lang.String definition code for java.lang.String  name)
          Creates a new BasicPermission with the specified name.
BasicPermission sample code for java.security.BasicPermission.BasicPermission(java.lang.String, java.lang.String) definition code for java.security.BasicPermission.BasicPermission(java.lang.String, java.lang.String) (String sample code for java.lang.String definition code for java.lang.String  name, String sample code for java.lang.String definition code for java.lang.String  actions)
          Creates a new BasicPermission object with the specified name.
 
Method Summary
 boolean equals sample code for java.security.BasicPermission.equals(java.lang.Object) definition code for java.security.BasicPermission.equals(java.lang.Object) (Object sample code for java.lang.Object definition code for java.lang.Object  obj)
          Checks two BasicPermission objects for equality.
 String sample code for java.lang.String definition code for java.lang.String getActions sample code for java.security.BasicPermission.getActions() definition code for java.security.BasicPermission.getActions() ()
          Returns the canonical string representation of the actions, which currently is the empty string "", since there are no actions for a BasicPermission.
 int hashCode sample code for java.security.BasicPermission.hashCode() definition code for java.security.BasicPermission.hashCode() ()
          Returns the hash code value for this object.
 boolean implies sample code for java.security.BasicPermission.implies(java.security.Permission) definition code for java.security.BasicPermission.implies(java.security.Permission) (Permission sample code for java.security.Permission definition code for java.security.Permission  p)
          Checks if the specified permission is "implied" by this object.
 PermissionCollection sample code for java.security.PermissionCollection definition code for java.security.PermissionCollection newPermissionCollection sample code for java.security.BasicPermission.newPermissionCollection() definition code for java.security.BasicPermission.newPermissionCollection() ()
          Returns a new PermissionCollection object for storing BasicPermission objects.
 
Methods inherited from class java.security.Permission sample code for java.security.Permission definition code for java.security.Permission
checkGuard sample code for java.security.Permission.checkGuard(java.lang.Object) definition code for java.security.Permission.checkGuard(java.lang.Object) , getName sample code for java.security.Permission.getName() definition code for java.security.Permission.getName() , toString sample code for java.security.Permission.toString() definition code for java.security.Permission.toString()
 
Methods inherited from class java.lang.Object sample code for java.lang.Object definition code for java.lang.Object
clone sample code for java.lang.Object.clone() definition code for java.lang.Object.clone() , finalize sample code for java.lang.Object.finalize() definition code for java.lang.Object.finalize() , getClass sample code for java.lang.Object.getClass() definition code for java.lang.Object.getClass() , notify sample code for java.lang.Object.notify() definition code for java.lang.Object.notify() , notifyAll sample code for java.lang.Object.notifyAll() definition code for java.lang.Object.notifyAll() , wait sample code for java.lang.Object.wait() definition code for java.lang.Object.wait() , wait sample code for java.lang.Object.wait(long) definition code for java.lang.Object.wait(long) , wait sample code for java.lang.Object.wait(long, int) definition code for java.lang.Object.wait(long, int)
 

Constructor Detail

BasicPermission sample code for java.security.BasicPermission(java.lang.String) definition code for java.security.BasicPermission(java.lang.String)

public BasicPermission(String sample code for java.lang.String definition code for java.lang.String  name)
Creates a new BasicPermission with the specified name. Name is the symbolic name of the permission, such as "setFactory", "print.queueJob", or "topLevelWindow", etc.

Parameters:
name - the name of the BasicPermission.
Throws:
NullPointerException sample code for java.lang.NullPointerException definition code for java.lang.NullPointerException - if name is null.
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - if name is empty.

BasicPermission sample code for java.security.BasicPermission(java.lang.String, java.lang.String) definition code for java.security.BasicPermission(java.lang.String, java.lang.String)

public BasicPermission(String sample code for java.lang.String definition code for java.lang.String  name,
                       String sample code for java.lang.String definition code for java.lang.String  actions)
Creates a new BasicPermission object with the specified name. The name is the symbolic name of the BasicPermission, and the actions String is currently unused.

Parameters:
name - the name of the BasicPermission.
actions - ignored.
Throws:
NullPointerException sample code for java.lang.NullPointerException definition code for java.lang.NullPointerException - if name is null.
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - if name is empty.
Method Detail

implies sample code for java.security.BasicPermission.implies(java.security.Permission) definition code for java.security.BasicPermission.implies(java.security.Permission)

public boolean implies(Permission sample code for java.security.Permission definition code for java.security.Permission  p)
Checks if the specified permission is "implied" by this object.

More specifically, this method returns true if:

Specified by:
implies sample code for java.security.Permission.implies(java.security.Permission) definition code for java.security.Permission.implies(java.security.Permission) in class Permission sample code for java.security.Permission definition code for java.security.Permission
Parameters:
p - the permission to check against.
Returns:
true if the passed permission is equal to or implied by this permission, false otherwise.

equals sample code for java.security.BasicPermission.equals(java.lang.Object) definition code for java.security.BasicPermission.equals(java.lang.Object)

public boolean equals(Object sample code for java.lang.Object definition code for java.lang.Object  obj)
Checks two BasicPermission objects for equality. Checks that obj's class is the same as this object's class and has the same name as this object.

Specified by:
equals sample code for java.security.Permission.equals(java.lang.Object) definition code for java.security.Permission.equals(java.lang.Object) in class Permission sample code for java.security.Permission definition code for java.security.Permission
Parameters:
obj - the object we are testing for equality with this object.
Returns:
true if obj is a BasicPermission, and has the same name as this BasicPermission object, false otherwise.
See Also:
Object.hashCode() sample code for java.lang.Object.hashCode() definition code for java.lang.Object.hashCode() , Hashtable sample code for java.util.Hashtable definition code for java.util.Hashtable

hashCode sample code for java.security.BasicPermission.hashCode() definition code for java.security.BasicPermission.hashCode()

public int hashCode()
Returns the hash code value for this object. The hash code used is the hash code of the name, that is, getName().hashCode(), where getName is from the Permission superclass.

Specified by:
hashCode sample code for java.security.Permission.hashCode() definition code for java.security.Permission.hashCode() in class Permission sample code for java.security.Permission definition code for java.security.Permission
Returns:
a hash code value for this object.
See Also:
Object.equals(java.lang.Object) sample code for java.lang.Object.equals(java.lang.Object) definition code for java.lang.Object.equals(java.lang.Object) , Hashtable sample code for java.util.Hashtable definition code for java.util.Hashtable

getActions sample code for java.security.BasicPermission.getActions() definition code for java.security.BasicPermission.getActions()

public String sample code for java.lang.String definition code for java.lang.String  getActions()
Returns the canonical string representation of the actions, which currently is the empty string "", since there are no actions for a BasicPermission.

Specified by:
getActions sample code for java.security.Permission.getActions() definition code for java.security.Permission.getActions() in class Permission sample code for java.security.Permission definition code for java.security.Permission
Returns:
the empty string "".

newPermissionCollection sample code for java.security.BasicPermission.newPermissionCollection() definition code for java.security.BasicPermission.newPermissionCollection()

public PermissionCollection sample code for java.security.PermissionCollection definition code for java.security.PermissionCollection  newPermissionCollection()
Returns a new PermissionCollection object for storing BasicPermission objects.

A BasicPermissionCollection stores a collection of BasicPermission permissions.

BasicPermission objects must be stored in a manner that allows them to be inserted in any order, but that also enables the PermissionCollection implies method to be implemented in an efficient (and consistent) manner.

Overrides:
newPermissionCollection sample code for java.security.Permission.newPermissionCollection() definition code for java.security.Permission.newPermissionCollection() in class Permission sample code for java.security.Permission definition code for java.security.Permission
Returns:
a new PermissionCollection object suitable for storing BasicPermissions.