Class UnixStyleGlobbing.GlobDefinition

  • Enclosing class:
    UnixStyleGlobbing

    public abstract static class UnixStyleGlobbing.GlobDefinition
    extends Object
    Provides information for performing globbing. This class parses glob patterns into a sequence of element patterns to be applied.

    File systems implementations should implement a subclass of this one to provide parsing of glob patterns appropriate for their pathing syntax.

    • Constructor Detail

      • GlobDefinition

        protected GlobDefinition​(String globPattern,
                                 String separators,
                                 String prefix)
        Defines a new globbing pattern.
        Parameters:
        globPattern - the full pattern for matching
        separators - valid path element separators
        prefix - a prefix to remove from the pattern, if present. Normally, this would be the file system prefix which, if removed, leaves only the hierarchical path.
    • Method Detail

      • getRootPath

        public abstract Path getRootPath()
        Gets the initial path from which globbing starts. Typically, this would be the root of the file system.
        Returns:
        the root path for applying globbing
      • getElementPatterns

        public List<String> getElementPatterns()
        Gets the globbing patterns for each element.
        Returns:
      • parseDirectoryPattern

        protected final String parseDirectoryPattern​(String pattern,
                                                     int start,
                                                     int end)
        Identifies the next element pattern between specified locations.
        Parameters:
        pattern - the complete globbing pattern
        start - the index of the first character in the element
        end - the upper bound on the element index
        Returns:
        the element pattern
      • parsePattern

        protected void parsePattern​(String pattern,
                                    List<String> directoryPatterns)
        Breaks a full globbing pattern into individual per-directory elements.
        Parameters:
        pattern - the pattern to parse
        directoryPatterns - the container into which to store the path element patterns.