Class RulesBuilder.ClassScope

java.lang.Object
org.cojen.boxtin.RulesBuilder.ClassScope
Enclosing class:
RulesBuilder

public static final class RulesBuilder.ClassScope extends Object
Builder of rules at the class level.
  • Method Details

    • denyAll

      public RulesBuilder.ClassScope denyAll()
      Deny access to all constructors and locally declared methods, superseding all previous rules.
      Returns:
      this
    • denyAll

      public RulesBuilder.ClassScope denyAll(DenyAction action)
      Deny access to all constructors and locally declared methods, superseding all previous rules.
      Returns:
      this
    • denyAllConstructors

      public RulesBuilder.ClassScope denyAllConstructors()
      Deny access to all constructors, superseding all previous rules.
      Returns:
      this
    • denyAllConstructors

      public RulesBuilder.ClassScope denyAllConstructors(DenyAction action)
      Deny access to all constructors, superseding all previous rules.
      Returns:
      this
    • denyAllMethods

      public RulesBuilder.ClassScope denyAllMethods()
      Deny access to all locally declared methods, superseding all previous rules.
      Returns:
      this
    • denyAllMethods

      public RulesBuilder.ClassScope denyAllMethods(DenyAction action)
      Deny access to all locally declared methods, superseding all previous rules.
      Returns:
      this
    • denyMethod

      public RulesBuilder.ClassScope denyMethod(String name)
      Deny access to all variants of the given method, superseding all previous rules.
      Returns:
      this
      Throws:
      IllegalArgumentException - if not a valid method name
    • denyMethod

      public RulesBuilder.ClassScope denyMethod(DenyAction action, String name)
      Deny access to all variants of the given method, superseding all previous rules.
      Returns:
      this
      Throws:
      IllegalArgumentException - if not a valid method name
    • allowVariant

      public RulesBuilder.ClassScope allowVariant(String descriptor)
      Allow access to a specific variant of the current constructor or method, superseding all previous rules.
      Parameters:
      descriptor - descriptor for the parameters, not including parenthesis or the return type
      Returns:
      this
      Throws:
      IllegalStateException - if no current constructor or method
    • allowVariant

      public RulesBuilder.ClassScope allowVariant(Class<?>... paramTypes)
      Allow access to a specific variant of the current constructor or method, superseding all previous rules.
      Returns:
      this
      Throws:
      IllegalStateException - if no current constructor or method, or if all variants are explicitly allowed
    • allowAll

      public RulesBuilder.ClassScope allowAll()
      Allow access to all constructors and locally declared methods, superseding all previous rules.
      Returns:
      this
    • allowAllConstructors

      public RulesBuilder.ClassScope allowAllConstructors()
      Allow access to all constructors, superseding all previous rules.
      Returns:
      this
    • allowAllMethods

      public RulesBuilder.ClassScope allowAllMethods()
      Allow access to all locally declared methods, superseding all previous rules.
      Returns:
      this
    • allowMethod

      public RulesBuilder.ClassScope allowMethod(String name)
      Allow access to all variants of the given method, superseding all previous rules.
      Returns:
      this
      Throws:
      IllegalArgumentException - if not a valid method name
    • denyVariant

      public RulesBuilder.ClassScope denyVariant(String descriptor)
      Deny access to a specific variant of the current constructor or method, superseding all previous rules.
      Parameters:
      descriptor - descriptor for the parameters, not including parenthesis or the return type
      Returns:
      this
      Throws:
      IllegalStateException - if no current constructor or method
    • denyVariant

      public RulesBuilder.ClassScope denyVariant(DenyAction action, String descriptor)
      Deny access to a specific variant of the current constructor or method, superseding all previous rules.
      Parameters:
      descriptor - descriptor for the parameters, not including parenthesis or the return type
      Returns:
      this
      Throws:
      IllegalStateException - if no current constructor or method
    • denyVariant

      public RulesBuilder.ClassScope denyVariant(Class<?>... paramTypes)
      Deny access to a specific variant of the current constructor or method, superseding all previous rules.
      Returns:
      this
      Throws:
      IllegalStateException - if no current constructor or method
    • denyVariant

      public RulesBuilder.ClassScope denyVariant(DenyAction action, Class<?>... paramTypes)
      Deny access to a specific variant of the current constructor or method, superseding all previous rules.
      Returns:
      this
      Throws:
      IllegalStateException - if no current constructor or method
    • end

      End the current rules for this class and return to the package scope. More rules can be added to this scope later if desired.
    • forClass

      public RulesBuilder.ClassScope forClass(String name)
      End the current rules for this class and begin a new class scope. More rules can be added to the scope later if desired.
    • forClass

      public RulesBuilder.ClassScope forClass(Class<?> clazz)
      End the current rules for this class and begin a new class scope. More rules can be added to the scope later if desired.
    • forPackage

      public RulesBuilder.PackageScope forPackage(String name)
      End the current rules for this class and package, and begin a new package scope. More rules can be added to the scope later if desired.
    • forModule

      public RulesBuilder.ModuleScope forModule(String name)
      End the current rules for this class, package and module, and begin a new module scope. More rules can be added to the scope later if desired.
      Parameters:
      name - fully qualified module name
      Throws:
      IllegalArgumentException - if the module isn't found
    • forModule

      public RulesBuilder.ModuleScope forModule(String name, String minVersion, String maxVersion)
      End the current rules for this class, package and module, and begin a new module scope. More rules can be added to the scope later if desired.
      Parameters:
      name - fully qualified module name
      minVersion - optional minimum module version number to support (inclusive)
      maxVersion - optional maximum module version number to support (exclusive)
      Throws:
      IllegalArgumentException - if the module isn't found, or if the version is out of bounds, or if the min/max versions provided aren't parseable