Package org.sonar.api.batch.fs
Interface FilePredicates
-
public interface FilePredicates
Factory ofFilePredicate
- Since:
- 4.2
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description FilePredicate
all()
Predicate that always evaluates to trueFilePredicate
and(java.util.Collection<FilePredicate> and)
FilePredicate
and(FilePredicate... and)
FilePredicate
and(FilePredicate first, FilePredicate second)
FilePredicate
doesNotMatchPathPattern(java.lang.String exclusionPattern)
Predicate that gets the files that do not match the given wildcard pattern.FilePredicate
doesNotMatchPathPatterns(java.lang.String[] exclusionPatterns)
Predicate that gets the files that do not match any of the given wildcard patterns.FilePredicate
hasAbsolutePath(java.lang.String s)
Predicate that find file by its absolute path.FilePredicate
hasAnyStatus()
Explicitely look for InputFile having anyInputFile.status()
FilePredicate
hasExtension(java.lang.String s)
Predicate that matches files by extension (case insensitive).FilePredicate
hasFilename(java.lang.String s)
Predicate that matches files by filename, in any directory.FilePredicate
hasLanguage(java.lang.String language)
FilePredicate
hasLanguages(java.lang.String... languages)
FilePredicate
hasLanguages(java.util.Collection<java.lang.String> languages)
FilePredicate
hasPath(java.lang.String s)
if the parameter represents an absolute path for the running environment, then returnshasAbsolutePath(String)
, elsehasRelativePath(String)
FilePredicate
hasRelativePath(java.lang.String s)
Predicate that gets a file by its relative path.FilePredicate
hasStatus(InputFile.Status status)
Look for InputFile having a specificInputFile.status()
FilePredicate
hasType(InputFile.Type type)
FilePredicate
hasURI(java.net.URI uri)
Predicate that gets a file by itsIndexedFile.uri()
.FilePredicate
is(java.io.File ioFile)
Warning - may not be supported in SonarLintFilePredicate
matchesPathPattern(java.lang.String inclusionPattern)
Predicate that gets the files which "path" matches a wildcard pattern.FilePredicate
matchesPathPatterns(java.lang.String[] inclusionPatterns)
Predicate that gets the files matching at least one wildcard pattern.FilePredicate
none()
Predicate that always evaluates to falseFilePredicate
not(FilePredicate p)
FilePredicate
or(java.util.Collection<FilePredicate> or)
FilePredicate
or(FilePredicate... or)
FilePredicate
or(FilePredicate first, FilePredicate second)
-
-
-
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 asbar.txt
). It must not benull
.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 parameterFoo.java
will match bothsome/path/Foo.java
andother/path/Foo.java
. The parameter must match exactly, no patterns are allowed, and it must not benull
.- Since:
- 6.3
-
hasExtension
FilePredicate hasExtension(java.lang.String s)
Predicate that matches files by extension (case insensitive). For example, the parameterjava
will matchsome/path/Foo.java
andother/path/Foo.JAVA
but notsome/path/Foo.js
. The parameter must not benull
.- Since:
- 6.3
-
hasURI
FilePredicate hasURI(java.net.URI uri)
Predicate that gets a file by itsIndexedFile.uri()
.- Since:
- 6.6
-
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 toall()
.- 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 toall()
.- See Also:
matchesPathPattern(String)
-
hasPath
FilePredicate hasPath(java.lang.String s)
if the parameter represents an absolute path for the running environment, then returnshasAbsolutePath(String)
, elsehasRelativePath(String)
Warning - may not be supported in SonarLint
-
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)
-
hasType
FilePredicate hasType(InputFile.Type type)
-
not
FilePredicate not(FilePredicate p)
-
or
FilePredicate or(java.util.Collection<FilePredicate> or)
-
or
FilePredicate or(FilePredicate... or)
-
or
FilePredicate or(FilePredicate first, FilePredicate second)
-
and
FilePredicate and(java.util.Collection<FilePredicate> and)
-
and
FilePredicate and(FilePredicate... and)
-
and
FilePredicate and(FilePredicate first, FilePredicate second)
-
hasStatus
FilePredicate hasStatus(InputFile.Status status)
Look for InputFile having a specificInputFile.status()
- Since:
- 6.6
-
hasAnyStatus
FilePredicate hasAnyStatus()
Explicitely look for InputFile having anyInputFile.status()
- Since:
- 6.6
-
-