Class FileImportControl

  • class FileImportControl
    extends AbstractImportControl
    Represents an import rules for a specific file. Only the file name is considered and only files processed by TreeWalker. The file's extension is ignored.
    • Field Detail

      • name

        private final String name
        The name for the file.
      • patternForExactMatch

        private final Pattern patternForExactMatch
        The regex pattern for exact matches - only not null if regex is true.
      • regex

        private final boolean regex
        If this file name represents a regular expression.
    • Constructor Detail

      • FileImportControl

        FileImportControl​(PkgImportControl parent,
                          String name,
                          boolean regex)
        Construct a file node.
        parent - the parent node.
        name - the name of the file.
        regex - flags interpretation of name as regex pattern.
    • Method Detail

      • encloseInGroup

        private static String encloseInGroup​(String expression)
        Enclose expression in a (non-capturing) group.
        expression - the input regular expression
        a grouped pattern.
      • createPatternForExactMatch

        private static Pattern createPatternForExactMatch​(String expression)
        Creates a Pattern from expression.
        expression - a self-contained regular expression matching the full file name exactly.
        a Pattern.