Interface Permissions
-
public interface PermissionsA collection of all existingpermission typesand their states.
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description static PermissionsfromBitmask(long bitmask)Creates aPermissionsobject from the given bitmask.static PermissionsfromBitmask(long allowedBitmask, long deniedBitmask)Creates aPermissionsobject from the given bitmasks.longgetAllowedBitmask()Gets the long containing all allowed permission types.default java.util.Collection<PermissionType>getAllowedPermission()Gets a collection with permission types which are set to (PermissionState.ALLOWED).longgetDeniedBitmask()Gets the long containing all denied permission types.default java.util.Collection<PermissionType>getDeniedPermissions()Gets a collection with permission types which are set to (PermissionState.DENIED).PermissionStategetState(PermissionType type)Gets the state of the given type.default java.util.Collection<PermissionType>getUnsetPermissions()Gets a collection with permission types which are set to (PermissionState.UNSET).booleanisEmpty()Checks if the all permission types are set toPermissionState.UNSET.default PermissionsBuildertoBuilder()Creates a new permissions builder from this permissions object.
-
-
-
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.
-
toBuilder
default PermissionsBuilder toBuilder()
Creates a new permissions builder from this permissions object.- Returns:
- The created builder.
- See Also:
PermissionsBuilder(Permissions)
-
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 toPermissionState.UNSET.- Returns:
- Whether all permission types are set to UNSET or not.
-
fromBitmask
static Permissions fromBitmask(long bitmask)
Creates aPermissionsobject from the given bitmask. Permissions that are not included are marked asPermissionState.UNSET.- Parameters:
bitmask- The bitmask of allowed permissions.- Returns:
- A
Permissionsobject created from the given bitmask.
-
fromBitmask
static Permissions fromBitmask(long allowedBitmask, long deniedBitmask)
Creates aPermissionsobject 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 asPermissionState.UNSET.- Parameters:
allowedBitmask- The bitmask of allowed permissions.deniedBitmask- The bitmask of denied permissions.- Returns:
- A
Permissionsobject created from the given bitmasks.
-
-