Enum Class PermissionCheckResult
- All Implemented Interfaces:
Serializable,Comparable<PermissionCheckResult>,Constable
The permission check results represents a tristate for a permission of permissible.
Possible values:
- Since:
- 4.0
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionThis check result indicates that the permissible has the permission and the potency of the permission is not negative.This check result indicates that the permissible does not have the permission.This check result indicates that the permissible has the permission but the potency is negative and therefore the permission is forbidden. -
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivatePermissionCheckResult(boolean value) Constructs a new check result. -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns the check result as a boolean indicating whether the permission should be granted or not.static @NonNull PermissionCheckResultfromBoolean(@Nullable Boolean value) Converts the nullable boolean into a permission check result.static @NonNull PermissionCheckResultfromPermission(@Nullable Permission permission) Converts the given permission into a permission check result.static PermissionCheckResultReturns the enum constant of this class with the specified name.static PermissionCheckResult[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
ALLOWED
This check result indicates that the permissible has the permission and the potency of the permission is not negative. Therefore, the permission is granted. -
DENIED
This check result indicates that the permissible does not have the permission. Therefore, the permission is denied. -
FORBIDDEN
This check result indicates that the permissible has the permission but the potency is negative and therefore the permission is forbidden.
-
-
Field Details
-
value
private final boolean value
-
-
Constructor Details
-
PermissionCheckResult
private PermissionCheckResult(boolean value) Constructs a new check result.- Parameters:
value- if the permission is present (allowed) or not.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
fromBoolean
@NonNull public static @NonNull PermissionCheckResult fromBoolean(@Nullable @Nullable Boolean value) Converts the nullable boolean into a permission check result. If the given boolean is null the result isDENIED, if the boolean is true thenALLOWED,FORBIDDENotherwise.- Parameters:
value- the boolean to convert- Returns:
- the converted check result.
-
fromPermission
@NonNull public static @NonNull PermissionCheckResult fromPermission(@Nullable @Nullable Permission permission) Converts the given permission into a permission check result. If the permission is null the result isDENIED, a potency that is not negative results in aALLOWED,FORBIDDENotherwise.- Parameters:
permission- the permission to convert.- Returns:
- the converted check result.
-
asBoolean
public boolean asBoolean()Returns the check result as a boolean indicating whether the permission should be granted or not.- Returns:
- the result as boolean.
-