Package org.sonar.api.batch.fs
Interface FilePredicates
-
- All Known Implementing Classes:
DefaultFilePredicates
public interface FilePredicatesFactory ofFilePredicate- Since:
- 4.2
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description FilePredicateall()Predicate that always evaluates to trueFilePredicateand(java.util.Collection<FilePredicate> and)FilePredicateand(FilePredicate... and)FilePredicateand(FilePredicate first, FilePredicate second)FilePredicatedoesNotMatchPathPattern(java.lang.String exclusionPattern)Predicate that gets the files that do not match the given wildcard pattern.FilePredicatedoesNotMatchPathPatterns(java.lang.String[] exclusionPatterns)Predicate that gets the files that do not match any of the given wildcard patterns.FilePredicatehasAbsolutePath(java.lang.String s)Predicate that find file by its absolute path.FilePredicatehasAnyStatus()Explicitely look for InputFile having anyInputFile.status()FilePredicatehasExtension(java.lang.String s)Predicate that matches files by extension (case insensitive).FilePredicatehasFilename(java.lang.String s)Predicate that matches files by filename, in any directory.FilePredicatehasLanguage(java.lang.String language)FilePredicatehasLanguages(java.lang.String... languages)FilePredicatehasLanguages(java.util.Collection<java.lang.String> languages)FilePredicatehasPath(java.lang.String s)if the parameter represents an absolute path for the running environment, then returnshasAbsolutePath(String), elsehasRelativePath(String)FilePredicatehasRelativePath(java.lang.String s)Predicate that gets a file by its relative path.FilePredicatehasStatus(InputFile.Status status)Look for InputFile having a specificInputFile.status()FilePredicatehasType(InputFile.Type type)FilePredicatehasURI(java.net.URI uri)Predicate that gets a file by itsIndexedFile.uri().FilePredicateis(java.io.File ioFile)Warning - may not be supported in SonarLintFilePredicatematchesPathPattern(java.lang.String inclusionPattern)Predicate that gets the files which "path" matches a wildcard pattern.FilePredicatematchesPathPatterns(java.lang.String[] inclusionPatterns)Predicate that gets the files matching at least one wildcard pattern.FilePredicatenone()Predicate that always evaluates to falseFilePredicatenot(FilePredicate p)FilePredicateor(java.util.Collection<FilePredicate> or)FilePredicateor(FilePredicate... or)FilePredicateor(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.txtis 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.txtis 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.javawill match bothsome/path/Foo.javaandother/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 parameterjavawill matchsome/path/Foo.javaandother/path/Foo.JAVAbut 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.javamatches Foo.java, src/Foo.java and src/java/SuperFoo.java**/*Foo*.javamatches src/Foo.java, src/BarFoo.java, src/FooBar.java and src/BarFooBaz.java**/*FOO.JAVAmatches 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
-
-