Class AllowedScope

java.lang.Object
io.micronaut.errorprone.noreflection.AllowedScope

public final class AllowedScope extends Object
A class or a package in which reflection is allowed, as a build names it, with the only categories allowed there when not all of them are.
  • com.example.ReflectionAccess - any reflection in the class, and in the classes and lambdas nested in it
  • com.example.Outer.Inner or com.example.Outer$Inner - in a nested class
  • com.example.internal.* - in any class of the package, or of a package below it
  • com.example.Handles:HANDLES+PROXY - only those categories, in the class
Since:
1.0.0
Author:
Denis Stepanov
  • Method Details

    • parse

      public static AllowedScope parse(String text)
      Parameters:
      text - The scope
      Returns:
      The scope parsed
      Throws:
      IllegalArgumentException - When it is not a scope or names an unknown category, saying why
    • scope

      public String scope()
      Returns:
      The class, or the package followed by .*, without the categories
    • categories

      public Set<ReflectionCategory> categories()
      Returns:
      The categories allowed, all of them when empty
    • allows

      public boolean allows(ReflectionCategory category)
      Parameters:
      category - A category
      Returns:
      Whether it is allowed in the scope
    • coversClass

      public boolean coversClass(String qualifiedName, String flatName)
      Parameters:
      qualifiedName - The qualified name of a class
      flatName - Its flat name, with a nested class joined by $
      Returns:
      Whether the scope is that class
    • coversPackage

      public boolean coversPackage(String packageName)
      Parameters:
      packageName - The name of a package
      Returns:
      Whether the scope is that package or a package above it
    • toFlag

      public String toFlag()
      Returns:
      The scope as the flag of the checks takes it
    • toString

      public String toString()
      Overrides:
      toString in class Object