com.sap.security.api.permissions
Class NamePermission

java.lang.Object
  |
  +--java.security.Permission
        |
        +--com.sap.security.api.permissions.NamePermission
All Implemented Interfaces:
java.security.Guard, java.io.Serializable
Direct Known Subclasses:
ActionPermission, ValuePermission

public class NamePermission
extends java.security.Permission
implements java.io.Serializable

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

The name for a NamePermission is the name of the given permission (for example, "Admin", "test", ...). There's no hierarchical name property.

The action string (inherited from Permission) is unused. Thus, NamePermission 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 NamePermission, if desired.

Version:
1.0 10/03/00
See Also:
Permission, Serialized Form

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

Constructor Detail

NamePermission

public NamePermission(java.lang.String name)
Creates a new NamePermission with the specified name. Name is the symbolic name of the permission.
Parameters:
name - the name of the NamePermission.

NamePermission

public NamePermission(java.lang.String name,
                      java.lang.String actions)
Creates a new NamePermission object with the specified name. The name is the symbolic name of the NamePermission, and the actions String is currently unused. This constructor exists to instantiate new Permission objects.
Parameters:
name - the name of the NamePermission.
actions - ignored.
Method Detail

implies

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

More specifically, this method returns true if:

Overrides:
implies in class 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

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

Overrides:
equals in class java.security.Permission
Parameters:
obj - the object we are testing for equality with this object.
Returns:
true if obj is a NamePermission, and has the same name as this NamePermission object, false otherwise.

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.
Overrides:
hashCode in class java.security.Permission
Returns:
a hash code value for this object.

getActions

public java.lang.String getActions()
Returns the canonical string representation of the actions, which currently is the empty string "", since there are no actions.
Overrides:
getActions in class java.security.Permission
Returns:
the empty string "".


Copyright © 2002 SAP AG All Rights Reserved.