org.sonar.api.batch.fs.internal
Class DefaultFilePredicates

java.lang.Object
  extended by org.sonar.api.batch.fs.internal.DefaultFilePredicates
All Implemented Interfaces:
FilePredicates

public class DefaultFilePredicates
extends Object
implements FilePredicates

Factory of FilePredicate

Since:
4.2

Method Summary
 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)
          Warning - not efficient because absolute path is not indexed yet.
 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)
          TODO document that non-normalized path and Windows-style path are supported
 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()
          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)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

all

public FilePredicate all()
Returns a predicate that always evaluates to true

Specified by:
all in interface FilePredicates

none

public FilePredicate none()
Returns a predicate that always evaluates to false

Specified by:
none in interface FilePredicates

hasAbsolutePath

public FilePredicate hasAbsolutePath(String s)
Warning - not efficient because absolute path is not indexed yet.

Specified by:
hasAbsolutePath in interface FilePredicates

hasRelativePath

public FilePredicate hasRelativePath(String s)
TODO document that non-normalized path and Windows-style path are supported

Specified by:
hasRelativePath in interface FilePredicates

matchesPathPattern

public FilePredicate matchesPathPattern(String inclusionPattern)
Description copied from interface: FilePredicates
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:

Specified by:
matchesPathPattern in interface FilePredicates

matchesPathPatterns

public FilePredicate matchesPathPatterns(String[] inclusionPatterns)
Description copied from interface: FilePredicates
Predicate that gets the files matching at least one wildcard pattern. No filter is applied when zero wildcard patterns (similar to FilePredicates.all().

Specified by:
matchesPathPatterns in interface FilePredicates
See Also:
FilePredicates.matchesPathPattern(String)

doesNotMatchPathPattern

public FilePredicate doesNotMatchPathPattern(String exclusionPattern)
Description copied from interface: FilePredicates
Predicate that gets the files that do not match the given wildcard pattern.

Specified by:
doesNotMatchPathPattern in interface FilePredicates
See Also:
FilePredicates.matchesPathPattern(String)

doesNotMatchPathPatterns

public FilePredicate doesNotMatchPathPatterns(String[] exclusionPatterns)
Description copied from interface: FilePredicates
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 FilePredicates.all().

Specified by:
doesNotMatchPathPatterns in interface FilePredicates
See Also:
FilePredicates.matchesPathPattern(String)

hasPath

public FilePredicate hasPath(String s)
Description copied from interface: FilePredicates
if the parameter represents an absolute path for the running environment, then returns FilePredicates.hasAbsolutePath(String), else FilePredicates.hasRelativePath(String)

Specified by:
hasPath in interface FilePredicates

is

public FilePredicate is(File ioFile)
Specified by:
is in interface FilePredicates

hasLanguage

public FilePredicate hasLanguage(String language)
Specified by:
hasLanguage in interface FilePredicates

hasLanguages

public FilePredicate hasLanguages(Collection<String> languages)
Specified by:
hasLanguages in interface FilePredicates

hasLanguages

public FilePredicate hasLanguages(String... languages)
Specified by:
hasLanguages in interface FilePredicates

hasStatus

public FilePredicate hasStatus(InputFile.Status status)
Specified by:
hasStatus in interface FilePredicates

hasType

public FilePredicate hasType(InputFile.Type type)
Specified by:
hasType in interface FilePredicates

not

public FilePredicate not(FilePredicate p)
Specified by:
not in interface FilePredicates

or

public FilePredicate or(Collection<FilePredicate> or)
Specified by:
or in interface FilePredicates

or

public FilePredicate or(FilePredicate... or)
Specified by:
or in interface FilePredicates

or

public FilePredicate or(FilePredicate first,
                        FilePredicate second)
Specified by:
or in interface FilePredicates

and

public FilePredicate and(Collection<FilePredicate> and)
Specified by:
and in interface FilePredicates

and

public FilePredicate and(FilePredicate... and)
Specified by:
and in interface FilePredicates

and

public FilePredicate and(FilePredicate first,
                         FilePredicate second)
Specified by:
and in interface FilePredicates


Copyright © 2009–2015 SonarSource. All rights reserved.