Interface Permission

  • All Known Implementing Classes:
    DotNamedPermission

    public interface Permission
    Interface for representing access to a system resource. All permissions have a name (whose interpretation depends on the subclass), as well as some functions for defining the semantics of the particular Permission subclass.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      Permission clone()
      Creates an exact copy of this instance.
      String getName()
      A string literal that identifies a resource or set of resources this permission object relates to.
      AuthorizationResult getResult()
      The authorization result or permission status.
      boolean implies​(Permission other)
      Basically, "permission p1 implies permission p2" means that if one is granted permission p1, one is naturally granted permission p2.
      boolean impliesName​(Permission other)
      If "permission p1 impliesName permission p2" means that the feature represented by p1 is a superset of p2.
      boolean impliesResult​(Permission other)
      If "permission p1 impliesResult permission p2" means that both permissions give the same result.
      void setResult​(AuthorizationResult result)
      Change the authorzation result.
    • Method Detail

      • getName

        String getName()
        A string literal that identifies a resource or set of resources this permission object relates to.

        It's up to every Permission implementation to define what's the set the name's format.

      • getResult

        AuthorizationResult getResult()
        The authorization result or permission status.
        Returns:
        One of the available results: GRANT / DENY / ABSTAIN
      • setResult

        void setResult​(AuthorizationResult result)
        Change the authorzation result.
        Parameters:
        result - GRANT / DENY / ABSTAIN
      • implies

        boolean implies​(Permission other)
        Basically, "permission p1 implies permission p2" means that if one is granted permission p1, one is naturally granted permission p2. Thus, this is not an equality test, but rather more of a subset test.

        Both calls to impliesName(Permission) & impliesResult(Permission) return true.

        Parameters:
        other - the permission to check against.
        Returns:
        true if the specified permission is implied by this object, false if not.
      • impliesName

        boolean impliesName​(Permission other)
        If "permission p1 impliesName permission p2" means that the feature represented by p1 is a superset of p2.
        Parameters:
        other - the permission to check against.
        Returns:
        true if the specified permission name is implied by this object, false if not.
      • impliesResult

        boolean impliesResult​(Permission other)
        If "permission p1 impliesResult permission p2" means that both permissions give the same result.
        Parameters:
        other - the permission to check against.
        Returns:
        true if the specified permission result is implied by this object, false if not.
      • clone

        Permission clone()
        Creates an exact copy of this instance.
        Returns:
        A brand new Permission instance