Interface Permissions


  • public interface Permissions
    A collection of all existing permission types and their states.
    • Method Detail

      • getAllowedBitmask

        long getAllowedBitmask()
        Gets the long containing all allowed permission types.
        Returns:
        The long containing all allowed permission types.
      • getDeniedBitmask

        long getDeniedBitmask()
        Gets the long containing all denied permission types.
        Returns:
        The long containing all denied permission types.
      • getState

        PermissionState getState​(PermissionType type)
        Gets the state of the given type.
        Parameters:
        type - The type.
        Returns:
        The state of the type.
      • getAllowedPermission

        default java.util.Collection<PermissionType> getAllowedPermission()
        Gets a collection with permission types which are set to (PermissionState.ALLOWED).
        Returns:
        A collection with all allowed permissions.
      • getDeniedPermissions

        default java.util.Collection<PermissionType> getDeniedPermissions()
        Gets a collection with permission types which are set to (PermissionState.DENIED).
        Returns:
        A collection with all denied permissions.
      • getUnsetPermissions

        default java.util.Collection<PermissionType> getUnsetPermissions()
        Gets a collection with permission types which are set to (PermissionState.UNSET).
        Returns:
        A collection with all unset permissions.
      • isEmpty

        boolean isEmpty()
        Checks if the all permission types are set to PermissionState.UNSET.
        Returns:
        Whether all permission types are set to UNSET or not.
      • fromBitmask

        static Permissions fromBitmask​(long bitmask)
        Creates a Permissions object from the given bitmask. Permissions that are not included are marked as PermissionState.UNSET.
        Parameters:
        bitmask - The bitmask of allowed permissions.
        Returns:
        A Permissions object created from the given bitmask.
      • fromBitmask

        static Permissions fromBitmask​(long allowedBitmask,
                                       long deniedBitmask)
        Creates a Permissions object from the given bitmasks.

        Permissions that are not included in any bitmap are marked as PermissionState.UNSET. If a permission is included in both the allowed and denied bitmap, it is marked as PermissionState.UNSET.

        Parameters:
        allowedBitmask - The bitmask of allowed permissions.
        deniedBitmask - The bitmask of denied permissions.
        Returns:
        A Permissions object created from the given bitmasks.