Class Permissions


  • public class Permissions
    extends Object
    Represents a group of permissions.
    • Field Detail

      • NO_PERMISSIONS

        public static final Permissions NO_PERMISSIONS
        Empty set of permissions
    • Constructor Detail

      • Permissions

        public Permissions​(BitSet mask)
        Constructs permission group from specified bit set
        Parameters:
        mask - bit set
      • Permissions

        public Permissions​(@NotNull
                           Permission... permissions)
        Initializes permission group from the permissions array
        Parameters:
        permissions - permissions to include into the group
      • Permissions

        public Permissions​(@NotNull
                           Collection<Permission> permissions)
        Initializes permission group from the permissions collection
        Parameters:
        permissions - permissions to include into the group
    • Method Detail

      • contains

        public boolean contains​(@NotNull
                                Permission permission)
        Returns true if this group of permissions contains the specified permission
        Parameters:
        permission - permission to check
        Returns:
        true if specified permission is in the group
      • containsAny

        public boolean containsAny​(@NotNull
                                   Permissions permissions)
        Returns true if this group of permissions contains at least one permission from the specified group.
        Parameters:
        permissions - permissions to check
        Returns:
        true if at least one permission from the specified group is contained in this group.
      • containsAll

        public boolean containsAll​(@NotNull
                                   Permissions permissions)
        Returns true if this group of permissions contains all of the specified permissions
        Parameters:
        permissions - permissions to check
        Returns:
        true if all of the specified permissions are contained in this group
      • toArray

        @NotNull
        public Permission[] toArray()
        Converts this group to array of permissions corresponding to bit set contained within this group
        Returns:
        array of permissions contained in this group
      • toList

        @NotNull
        public List<Permission> toList()
        Returns this group of permissions as list.
        Returns:
        list of permissions
      • getMask

        @NotNull
        public BitSet getMask()
        Returns bit set of the permissions contained in this group
        Returns:
        bit set of the permissions contained in this group
      • isEmpty

        public boolean isEmpty()
        Returns:
        true if the permissions mask is empty and false otherwise
      • mergeWith

        @NotNull
        public Permissions mergeWith​(@NotNull
                                     Permissions permissions)
        Creates a new permissions instance by merging permissions of this instance and the one passed as an argument
        Parameters:
        permissions - another instance of permissions to merge with
        Returns:
        see above
        Since:
        2020.2
      • intersectWith

        @NotNull
        public Permissions intersectWith​(@NotNull
                                         Permissions permissions)
        Creates a new permissions instance by intersecting permissions of this instance and the one passed as an argument
        Parameters:
        permissions - another instance of permissions to intersect with
        Returns:
        see above
        Since:
        2024.12
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object