Enum Class PermissionCheckResult

java.lang.Object
java.lang.Enum<PermissionCheckResult>
eu.cloudnetservice.driver.permission.PermissionCheckResult
All Implemented Interfaces:
Serializable, Comparable<PermissionCheckResult>, Constable

public enum PermissionCheckResult extends Enum<PermissionCheckResult>
The permission check results represents a tristate for a permission of permissible.

Possible values:

Since:
4.0
  • Enum Constant Details

    • ALLOWED

      public static final PermissionCheckResult 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

      public static final PermissionCheckResult DENIED
      This check result indicates that the permissible does not have the permission. Therefore, the permission is denied.
    • FORBIDDEN

      public static final PermissionCheckResult 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

      public static PermissionCheckResult[] 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

      public static PermissionCheckResult valueOf(String name)
      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 name
      NullPointerException - if the argument is null
    • fromBoolean

      Converts the nullable boolean into a permission check result. If the given boolean is null the result is DENIED, if the boolean is true then ALLOWED, FORBIDDEN otherwise.
      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 is DENIED, a potency that is not negative results in a ALLOWED, FORBIDDEN otherwise.
      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.