Class ISPermissionCollection

  • All Implemented Interfaces:
    Serializable

    public class ISPermissionCollection
    extends PermissionCollection
    This class represents a collection of ISPermission objects. It extends from PermissionCollection providing implementation of abstract methods like add, implies elements. The rest of the required methods are used from the parent class.

    With any PermissionCollection, you can:

    • add a permission to the collection using the add method.
    • check to see if a particular permission is implied in the collection, using the implies method.
    • enumerate all the permissions, using the elements method.

    When it is desirable to group together a number of Permission objects of the same type, the newPermissionCollection method on that particular type of Permission object should first be called. The default behavior of the ISPermission class is to simply return a new instance of ISPermissionCollection(). The caller of newPermissionCollection would need to store permissions of the ISPermission in ISPermissionCollection returned.

    The ISPermissionCollection returned by the Permission.newPermissionCollection method is a homogeneous collection, which stores only ISPermission objects.

    See Also:
    Permission, PermissionCollection, Permissions, Serialized Form
    • Constructor Detail

      • ISPermissionCollection

        public ISPermissionCollection()
    • Method Detail

      • add

        public void add​(Permission perm)
        Adds a permission object to the current collection of ISPermission objects.
        Specified by:
        add in class PermissionCollection
        Parameters:
        perm - the ISPermission object to add.
        Throws:
        SecurityException - if this PermissionCollection object has been marked readonly exception IllegalArgumentException if the passed permission is not of ISPermission instance.
      • elements

        public Enumeration elements()
        This method returns an Enumeration of permissions in this collection, which is ISPermission in our case. This method gets called internally by java security code, to get all the permissions stored in this permission collection.
        Specified by:
        elements in class PermissionCollection
        Returns:
        Enumeration of all the ISPermissions held in this collection.
      • implies

        public boolean implies​(Permission perm)
        Checks to see if the specified permission is implied by the collection of ISPermission objects held in this ISPermissionCollection. This method takes in a permission and loops through all the permissions in its store and call their implies> to evaluate the result.
        Specified by:
        implies in class PermissionCollection
        Parameters:
        perm - the Permission object to compare.
        Returns:
        true if "permission" is implied by the permissions in the collection, false if not.