Class DefaultPermissionCollection

    • Constructor Detail

      • DefaultPermissionCollection

        public DefaultPermissionCollection()
    • Method Detail

      • get

        public Permission get​(String name)
        Description copied from interface: PermissionCollection
        Gets a permission object matching the specified name.
        Specified by:
        get in interface PermissionCollection
        Parameters:
        name - The fully qualified name of the permission.
        Returns:
        A Permission instance or null if not found.
      • equalsName

        protected boolean equalsName​(String s1,
                                     String s2)
      • implies

        public boolean implies​(Permission permission)
        Description copied from interface: PermissionCollection
        Checks to see if the specified permission is implied by the collection of Permission objects held in this PermissionCollection.
        Specified by:
        implies in interface PermissionCollection
        Parameters:
        permission - the Permission object to compare.
        Returns:
        true if "permission" is implied by the permissions in the collection, false if not.
      • impliesName

        public boolean impliesName​(Permission permission)
        Description copied from interface: PermissionCollection
        It returns true provided this collection already contains a permission which implies by name (See Permission.impliesName(Permission)) the permission passed as a parameter.
        Specified by:
        impliesName in interface PermissionCollection
        Parameters:
        permission - the permission to check
        Returns:
        true if the permission name is implied by this collection, false otherwise.
      • merge

        public PermissionCollection merge​(PermissionCollection other,
                                          int priority)
        Description copied from interface: PermissionCollection
        Get all the permissions from this collection and the given one and puts them into a brand new collection instance. Any "redundant" permission instance ("implied" by other permissions in the collection) are left out from the outcome. Notice also, the priority parameter is taken into account in case the same permission is present in both collections.
        Specified by:
        merge in interface PermissionCollection
        Parameters:
        other - the collection to merge.
        priority - integer indicating what to do if the same permission is found in both collections:
        • 0 = same priority (GRANTED permissions win by default)
        • negative integer = this collection wins
        • positive integer = the other collection wins
        Returns:
        A collection containing the merge result.