Class ClassScope

  • All Implemented Interfaces:
    Scope

    public final class ClassScope
    extends Object
    implements Scope
    Scope limited to classes matching a pattern or exact name.
    • Constructor Detail

      • ClassScope

        public ClassScope​(String pattern,
                          boolean isRegex)
        Creates a class scope.
        Parameters:
        pattern - the class name or regex to match
        isRegex - whether pattern is a regular expression
    • Method Detail

      • pattern

        public String pattern()
        Returns:
        the class name or regex pattern
      • isRegex

        public boolean isRegex()
        Returns:
        whether the pattern is a regular expression
      • exact

        public static ClassScope exact​(String className)
        Creates a scope matching one exact class name.
        Parameters:
        className - the internal class name to match
        Returns:
        the exact-name scope
      • regex

        public static ClassScope regex​(String pattern)
        Creates a scope matching class names against a regex.
        Parameters:
        pattern - the regular expression class names must match
        Returns:
        the regex scope
      • matches

        public boolean matches​(String className)
        Tests a class name against this scope.
        Parameters:
        className - the internal class name to test
        Returns:
        true if the name matches the pattern
      • accept

        public <T> T accept​(ScopeVisitor<T> visitor)
        Description copied from interface: Scope
        Dispatches to the visitor hook for this scope variant.
        Specified by:
        accept in interface Scope
        Type Parameters:
        T - the visitor's result type
        Parameters:
        visitor - the visitor to dispatch to
        Returns:
        whatever the visitor returns for this variant
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object