Class GuaranteedPermission

All Implemented Interfaces:
Serializable, Guard

public class GuaranteedPermission
extends MetaPermission
A custom Java security Permission that overrides a DeniedPermission, ensuring that a given property can be accessed even if otherwise denied or not granted.
See Also:
Serialized Form
  • Method Details

    • newGuaranteedPermission

      @Permissions public static GuaranteedPermission newGuaranteedPermission​(String targetClassName, @Nullable String targetName, @Nullable String targetActions)
      Instantiates a GuaranteedPermission that encapsulates a target permission of the indicated class, specified name and, optionally, actions.
      Parameters:
      targetClassName - The name of the class of the Permission to be allowed (even if otherwise denied).
      targetName - The target for the Permission to be allowed.
      targetActions - The actions (if any) to be specifically denied by the underlying class.
      Throws:
      IllegalArgumentException - if:
      • targetClassName is null, the empty string, does not refer to a concrete Permission descendant, or refers to any MetaPermission.class or UnresolvedPermission.class.
      • targetName is null.
      • targetClassName cannot be instantiated, and it's the caller's fault; e.g., because targetName and/or targetActions do not adhere to the naming constraints of the target class; or due to the target class not exposing a (String name), or (String name, String actions) constructor, depending on whether targetActions is null or not.
      SecurityException - if a SecurityManager, sm, is installed, and the invocation sm.checkPackageAccess(targetClassPackageName) (where targetClassPackageName is the package of the class referred to by targetClassName) denies access.
    • newGuaranteedPermission

      @Permissions public static GuaranteedPermission newGuaranteedPermission​(Permission target)
      Instantiates a GuaranteedPermission that encapsulates the given target permission.
      Parameters:
      target - The Permission that is being explicitly permitted (even if otherwise denied).
      Throws:
      IllegalArgumentException - if target is null, a MetaPermission, or an UnresolvedPermission.
    • implies

      public boolean implies​(Permission p)
      Checks whether the given permission is implied by this one, as per the overview.
      Overrides:
      implies in class MetaPermission
      Parameters:
      p - The Permission being checked.