public class DefaultFilePredicates extends Object implements FilePredicates
FilePredicate
Constructor and Description |
---|
DefaultFilePredicates(Path baseDir)
Client code should use
FileSystem.predicates() to get an instance |
Modifier and Type | Method and Description |
---|---|
FilePredicate |
all()
Returns a predicate that always evaluates to true
|
FilePredicate |
and(Collection<FilePredicate> and) |
FilePredicate |
and(FilePredicate... and) |
FilePredicate |
and(FilePredicate first,
FilePredicate second) |
FilePredicate |
doesNotMatchPathPattern(String exclusionPattern)
Predicate that gets the files that do not match the given wildcard pattern.
|
FilePredicate |
doesNotMatchPathPatterns(String[] exclusionPatterns)
Predicate that gets the files that do not match any of the given wildcard patterns.
|
FilePredicate |
hasAbsolutePath(String s)
Predicate that find file by its absolute path.
|
FilePredicate |
hasAnyStatus()
Explicitely look for InputFile having any
InputFile.status() |
FilePredicate |
hasExtension(String s)
Predicate that matches files by extension (case insensitive).
|
FilePredicate |
hasFilename(String s)
Predicate that matches files by filename, in any directory.
|
FilePredicate |
hasLanguage(String language) |
FilePredicate |
hasLanguages(Collection<String> languages) |
FilePredicate |
hasLanguages(String... languages) |
FilePredicate |
hasPath(String s)
if the parameter represents an absolute path for the running environment, then
returns
FilePredicates.hasAbsolutePath(String) , else FilePredicates.hasRelativePath(String) |
FilePredicate |
hasRelativePath(String s)
non-normalized path and Windows-style path are supported
|
FilePredicate |
hasStatus(InputFile.Status status)
Look for InputFile having a specific
InputFile.status() |
FilePredicate |
hasType(InputFile.Type type) |
FilePredicate |
hasURI(URI uri)
Predicate that gets a file by its
IndexedFile.uri() . |
FilePredicate |
is(File ioFile)
Warning - may not be supported in SonarLint
|
FilePredicate |
matchesPathPattern(String inclusionPattern)
Predicate that gets the files which "path" matches a wildcard pattern.
|
FilePredicate |
matchesPathPatterns(String[] inclusionPatterns)
Predicate that gets the files matching at least one wildcard pattern.
|
FilePredicate |
none()
Returns a predicate that always evaluates to false
|
FilePredicate |
not(FilePredicate p) |
FilePredicate |
or(Collection<FilePredicate> or) |
FilePredicate |
or(FilePredicate... or) |
FilePredicate |
or(FilePredicate first,
FilePredicate second) |
public DefaultFilePredicates(Path baseDir)
FileSystem.predicates()
to get an instancepublic FilePredicate all()
all
in interface FilePredicates
public FilePredicate none()
none
in interface FilePredicates
public FilePredicate hasAbsolutePath(String s)
FilePredicates
/path/to/../foo.txt
is same as /path/foo.txt
).
Warning - may not be supported in SonarLint
hasAbsolutePath
in interface FilePredicates
public FilePredicate hasRelativePath(String s)
hasRelativePath
in interface FilePredicates
public FilePredicate hasFilename(String s)
FilePredicates
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
.hasFilename
in interface FilePredicates
public FilePredicate hasExtension(String s)
FilePredicates
java
will match
some/path/Foo.java
and other/path/Foo.JAVA
but not some/path/Foo.js
.
The parameter must not be null
.hasExtension
in interface FilePredicates
public FilePredicate hasURI(URI uri)
FilePredicates
IndexedFile.uri()
.hasURI
in interface FilePredicates
public FilePredicate matchesPathPattern(String inclusionPattern)
FilePredicates
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.javamatchesPathPattern
in interface FilePredicates
public FilePredicate matchesPathPatterns(String[] inclusionPatterns)
FilePredicates
FilePredicates.all()
.matchesPathPatterns
in interface FilePredicates
FilePredicates.matchesPathPattern(String)
public FilePredicate doesNotMatchPathPattern(String exclusionPattern)
FilePredicates
doesNotMatchPathPattern
in interface FilePredicates
FilePredicates.matchesPathPattern(String)
public FilePredicate doesNotMatchPathPatterns(String[] exclusionPatterns)
FilePredicates
FilePredicates.all()
.doesNotMatchPathPatterns
in interface FilePredicates
FilePredicates.matchesPathPattern(String)
public FilePredicate hasPath(String s)
FilePredicates
FilePredicates.hasAbsolutePath(String)
, else FilePredicates.hasRelativePath(String)
Warning - may not be supported in SonarLint
hasPath
in interface FilePredicates
public FilePredicate is(File ioFile)
FilePredicates
is
in interface FilePredicates
public FilePredicate hasLanguage(String language)
hasLanguage
in interface FilePredicates
public FilePredicate hasLanguages(Collection<String> languages)
hasLanguages
in interface FilePredicates
public FilePredicate hasLanguages(String... languages)
hasLanguages
in interface FilePredicates
public FilePredicate hasType(InputFile.Type type)
hasType
in interface FilePredicates
public FilePredicate not(FilePredicate p)
not
in interface FilePredicates
public FilePredicate or(Collection<FilePredicate> or)
or
in interface FilePredicates
public FilePredicate or(FilePredicate... or)
or
in interface FilePredicates
public FilePredicate or(FilePredicate first, FilePredicate second)
or
in interface FilePredicates
public FilePredicate and(Collection<FilePredicate> and)
and
in interface FilePredicates
public FilePredicate and(FilePredicate... and)
and
in interface FilePredicates
public FilePredicate and(FilePredicate first, FilePredicate second)
and
in interface FilePredicates
public FilePredicate hasStatus(InputFile.Status status)
FilePredicates
InputFile.status()
hasStatus
in interface FilePredicates
public FilePredicate hasAnyStatus()
FilePredicates
InputFile.status()
hasAnyStatus
in interface FilePredicates
Copyright © 2009–2017 SonarSource. All rights reserved.