Class Rule

java.lang.Object
org.cojen.boxtin.Rule
All Implemented Interfaces:
Rules.ForClass

public sealed class Rule extends Object implements Rules.ForClass
Indicates if access to an operation is allowed or denied.
  • Method Details

    • allow

      public static Rule allow()
      Returns a singleton rule which is always allowed.
    • deny

      public static Rule deny()
      Returns a singleton rule which is always denied, with the standard action.
    • deny

      public static Rule deny(DenyAction action)
      Returns a rule which is denied with the given action.
    • isAllowed

      public final boolean isAllowed()
      Returns true if the rule is always allowed.
    • isDenied

      public boolean isDenied()
      Returns true if the rule is always denied.
    • denyAction

      public DenyAction denyAction()
      Returns the deny action for this rule, which is null if the rule isn't denied.
      Returns:
      null if not denied
    • isAnyDenied

      public final boolean isAnyDenied()
      Same as isDenied().
      Specified by:
      isAnyDenied in interface Rules.ForClass
    • isConstructionDenied

      public final boolean isConstructionDenied()
      Same as isDenied().
      Specified by:
      isConstructionDenied in interface Rules.ForClass
    • ruleForConstructor

      public final Rule ruleForConstructor(CharSequence descriptor)
      Returns this.
      Specified by:
      ruleForConstructor in interface Rules.ForClass
      Parameters:
      descriptor - descriptor for the parameters, including parenthesis, but the return type is optional
    • ruleForConstructor

      public final Rule ruleForConstructor(Class<?>... paramTypes)
      Returns this.
      Specified by:
      ruleForConstructor in interface Rules.ForClass
    • ruleForMethod

      public final Rule ruleForMethod(CharSequence name, CharSequence descriptor)
      Returns this.
      Specified by:
      ruleForMethod in interface Rules.ForClass
      Parameters:
      descriptor - descriptor for the parameters, including parenthesis, but the return type is optional
    • ruleForMethod

      public final Rule ruleForMethod(CharSequence name, Class<?>... paramTypes)
      Returns this.
      Specified by:
      ruleForMethod in interface Rules.ForClass
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object