Interface FilePredicates


  • public interface FilePredicates
    Factory of FilePredicate
    Since:
    4.2
    • Method Detail

      • all

        FilePredicate all()
        Predicate that always evaluates to true
      • none

        FilePredicate none()
        Predicate that always evaluates to false
      • hasAbsolutePath

        FilePredicate hasAbsolutePath​(java.lang.String s)
        Predicate that find file by its absolute path. The parameter accepts forward/back slashes as separator and non-normalized values (/path/to/../foo.txt is same as /path/foo.txt).

        Warning - may not be supported in SonarLint

      • hasRelativePath

        FilePredicate hasRelativePath​(java.lang.String s)
        Predicate that gets a file by its relative path. The parameter accepts forward/back slashes as separator and non-normalized values (foo/../bar.txt is same as bar.txt). It must not be null.

        Warning - may not be supported in SonarLint

      • hasFilename

        FilePredicate hasFilename​(java.lang.String s)
        Predicate that matches files by filename, in any directory. For example, the parameter Foo.java will match both some/path/Foo.java and other/path/Foo.java. The parameter must match exactly, no patterns are allowed, and it must not be null.
        Since:
        6.3
      • hasExtension

        FilePredicate hasExtension​(java.lang.String s)
        Predicate that matches files by extension (case insensitive). For example, the parameter java will match some/path/Foo.java and other/path/Foo.JAVA but not some/path/Foo.js. The parameter must not be null.
        Since:
        6.3
      • matchesPathPattern

        FilePredicate matchesPathPattern​(java.lang.String inclusionPattern)
        Predicate that gets the files which "path" matches a wildcard pattern.

        The path is the path part of the IndexedFile.uri(). Pattern is case-sensitive, except for file extension.

        Supported wildcards are * and **, but not ?.
        Examples:

        • **/*Foo.java matches Foo.java, src/Foo.java and src/java/SuperFoo.java
        • **/*Foo*.java matches src/Foo.java, src/BarFoo.java, src/FooBar.java and src/BarFooBaz.java
        • **/*FOO.JAVA matches FOO.java and FOO.JAVA but not Foo.java
      • matchesPathPatterns

        FilePredicate matchesPathPatterns​(java.lang.String[] inclusionPatterns)
        Predicate that gets the files matching at least one wildcard pattern. No filter is applied when zero wildcard patterns (similar to all().
        See Also:
        matchesPathPattern(String)
      • doesNotMatchPathPattern

        FilePredicate doesNotMatchPathPattern​(java.lang.String exclusionPattern)
        Predicate that gets the files that do not match the given wildcard pattern.
        See Also:
        matchesPathPattern(String)
      • doesNotMatchPathPatterns

        FilePredicate doesNotMatchPathPatterns​(java.lang.String[] exclusionPatterns)
        Predicate that gets the files that do not match any of the given wildcard patterns. No filter is applied when zero wildcard patterns (similar to all().
        See Also:
        matchesPathPattern(String)
      • is

        FilePredicate is​(java.io.File ioFile)
        Warning - may not be supported in SonarLint
      • hasLanguage

        FilePredicate hasLanguage​(java.lang.String language)
      • hasLanguages

        FilePredicate hasLanguages​(java.util.Collection<java.lang.String> languages)
      • hasLanguages

        FilePredicate hasLanguages​(java.lang.String... languages)