Build 1.0_r1(from source)

java.security
Class BasicPermission

java.lang.Object
  extended by java.security.Permission
      extended by java.security.BasicPermission
All Implemented Interfaces:
Serializable, Guard
Direct Known Subclasses:
AuthPermission, LoggingPermission, NetPermission, PropertyPermission, ReflectPermission, RuntimePermission, SecurityPermission, SerializablePermission, SQLPermission, SSLPermission

public abstract class BasicPermission
extends Permission
implements Serializable

Superclass of permissions which have names but no action lists.

See Also:
Serialized Form

Constructor Summary
BasicPermission(String name)
          Creates an instance of this class with the given name and action list.
BasicPermission(String name, String action)
          Creates an instance of this class with the given name and action list.
 
Method Summary
 boolean equals(Object obj)
          Compares the argument to the receiver, and returns true if they represent the same object using a class specific comparison.
 String getActions()
          Returns the actions associated with the receiver.
 int hashCode()
          Returns an integer hash code for the receiver.
 boolean implies(Permission permission)
          Indicates whether the argument permission is implied by the receiver.
(package private) static boolean nameImplies(String thisName, String thatName)
          Checks if thisName implies thatName, accordingly to hierarchical property naming convention.
 PermissionCollection newPermissionCollection()
          Returns a new PermissionCollection for holding permissions of this class.
 
Methods inherited from class java.security.Permission
checkGuard, getName, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BasicPermission

public BasicPermission(String name)
Creates an instance of this class with the given name and action list.

Parameters:
name - String the name of the new permission.

BasicPermission

public BasicPermission(String name,
                       String action)
Creates an instance of this class with the given name and action list. The action list is ignored.

Parameters:
name - String the name of the new permission.
action - String ignored.
Method Detail

equals

public boolean equals(Object obj)
Compares the argument to the receiver, and returns true if they represent the same object using a class specific comparison. In this case, the receiver and the object must have the same class and name.

Specified by:
equals in class Permission
Parameters:
obj - the object to compare with this object
Returns:
true if the object is the same as this object false if it is different from this object
See Also:
hashCode()

hashCode

public int hashCode()
Returns an integer hash code for the receiver. Any two objects which answer true when passed to equals must answer the same value for this method.

Specified by:
hashCode in class Permission
Returns:
int the receiver's hash
See Also:
equals(java.lang.Object)

getActions

public String getActions()
Returns the actions associated with the receiver. BasicPermission objects have no actions, so answer the empty string.

Specified by:
getActions in class Permission
Returns:
String the actions associated with the receiver.

implies

public boolean implies(Permission permission)
Indicates whether the argument permission is implied by the receiver.

Specified by:
implies in class Permission
Parameters:
permission - java.security.Permission the permission to check
Returns:
boolean true if the argument permission is implied by the receiver, and false if it is not.

nameImplies

static boolean nameImplies(String thisName,
                           String thatName)
Checks if thisName implies thatName, accordingly to hierarchical property naming convention. It is assumed that names cannot be null or empty.


newPermissionCollection

public PermissionCollection newPermissionCollection()
Returns a new PermissionCollection for holding permissions of this class. Answer null if any permission collection can be used.

Note: For BasicPermission (and subclasses which do not override this method), the collection which is returned does not invoke the .implies method of the permissions which are stored in it when checking if the collection implies a permission. Instead, it assumes that if the type of the permission is correct, and the name of the permission is correct, there is a match.

Overrides:
newPermissionCollection in class Permission
Returns:
a new PermissionCollection or null
See Also:
BasicPermissionCollection

Build 1.0_r1(from source)

Please submit a feedback, bug or feature