Class GlobFilePathFilter

  • All Implemented Interfaces:
    Serializable

    @Internal
    public class GlobFilePathFilter
    extends FilePathFilter
    Class for determining if a particular file should be included or excluded based on a set of include and exclude glob filters.

    Glob filter support the following expressions:

    • * - matches any number of any characters including none
    • ** - matches any file in all subdirectories
    • ? - matches any single character
    • [abc] - matches one of the characters listed in a brackets
    • [a-z] - matches one character from the range given in the brackets

    If does not match an include pattern it is excluded. If it matches and include pattern but also matches an exclude pattern it is excluded.

    If no patterns are provided all files are included

    See Also:
    Serialized Form
    • Constructor Detail

      • GlobFilePathFilter

        public GlobFilePathFilter()
        Constructor for GlobFilePathFilter that will match all files
      • GlobFilePathFilter

        public GlobFilePathFilter​(List<String> includePatterns,
                                  List<String> excludePatterns)
        Constructor for GlobFilePathFilter
        Parameters:
        includePatterns - glob patterns for files to include
        excludePatterns - glob patterns for files to exclude
    • Method Detail

      • filterPath

        public boolean filterPath​(Path filePath)
        Description copied from class: FilePathFilter
        Returns true if the filePath given is to be ignored when processing a directory, e.g.
        
         public boolean filterPaths(Path filePath) {
             return filePath.getName().startsWith(".") || filePath.getName().contains("_COPYING_");
         }
         
        Specified by:
        filterPath in class FilePathFilter