org.sonar.api.batch.fs
Interface FilePredicates

All Known Implementing Classes:
DefaultFilePredicates

public interface FilePredicates

Factory of FilePredicate

Since:
4.2

Method Summary
 FilePredicate all()
          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 gets a file by its absolute path.
 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 hasAbsolutePath(String), else hasRelativePath(String)
 FilePredicate hasRelativePath(String s)
          Predicate that gets a file by its relative path.
 FilePredicate hasStatus(InputFile.Status status)
           
 FilePredicate hasType(InputFile.Type type)
           
 FilePredicate is(File ioFile)
           
 FilePredicate matchesPathPattern(String inclusionPattern)
          Predicate that gets the files which relative or absolute path matches a wildcard pattern.
 FilePredicate matchesPathPatterns(String[] inclusionPatterns)
          Predicate that gets the files matching at least one wildcard pattern.
 FilePredicate none()
          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)
           
 

Method Detail

all

FilePredicate all()
Predicate that always evaluates to true


none

FilePredicate none()
Predicate that always evaluates to false


hasAbsolutePath

FilePredicate hasAbsolutePath(String s)
Predicate that gets a 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 - not efficient because absolute path is not indexed yet.


hasRelativePath

FilePredicate hasRelativePath(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.


matchesPathPattern

FilePredicate matchesPathPattern(String inclusionPattern)
Predicate that gets the files which relative or absolute path matches a wildcard pattern.

If the parameter starts with file:, then absolute path is used, else relative path. Pattern is case-sensitive, except for file extension.

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

Examples:


matchesPathPatterns

FilePredicate matchesPathPatterns(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(String exclusionPattern)
Predicate that gets the files that do not match the given wildcard pattern.

See Also:
matchesPathPattern(String)

doesNotMatchPathPatterns

FilePredicate doesNotMatchPathPatterns(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)

hasPath

FilePredicate hasPath(String s)
if the parameter represents an absolute path for the running environment, then returns hasAbsolutePath(String), else hasRelativePath(String)


is

FilePredicate is(File ioFile)

hasLanguage

FilePredicate hasLanguage(String language)

hasLanguages

FilePredicate hasLanguages(Collection<String> languages)

hasLanguages

FilePredicate hasLanguages(String... languages)

hasStatus

FilePredicate hasStatus(InputFile.Status status)

hasType

FilePredicate hasType(InputFile.Type type)

not

FilePredicate not(FilePredicate p)

or

FilePredicate or(Collection<FilePredicate> or)

or

FilePredicate or(FilePredicate... or)

or

FilePredicate or(FilePredicate first,
                 FilePredicate second)

and

FilePredicate and(Collection<FilePredicate> and)

and

FilePredicate and(FilePredicate... and)

and

FilePredicate and(FilePredicate first,
                  FilePredicate second)


Copyright © 2009–2015 SonarSource. All rights reserved.