From 482fa89e9cc3eb7eebd5439ee5b3d044d5fe42c3 Mon Sep 17 00:00:00 2001 From: Simon Brandhof Date: Mon, 6 Oct 2014 17:56:45 +0200 Subject: Add some javadoc to FilePredicates --- .../org/sonar/api/batch/fs/FilePredicates.java | 48 ++++++++++++++++++++-- 1 file changed, 45 insertions(+), 3 deletions(-) diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/FilePredicates.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/FilePredicates.java index 65a2e19d6a5..4dcc80df393 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/FilePredicates.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/FilePredicates.java @@ -29,33 +29,75 @@ import java.util.Collection; */ public interface FilePredicates { /** - * Returns a predicate that always evaluates to true + * Predicate that always evaluates to true */ FilePredicate all(); /** - * Returns a predicate that always evaluates to false + * Predicate that always evaluates to false */ FilePredicate none(); /** + * 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. */ FilePredicate hasAbsolutePath(String s); /** - * TODO document that non-normalized path and Windows-style path are supported + * 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. */ FilePredicate hasRelativePath(String s); + /** + * 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: + *

+ */ FilePredicate matchesPathPattern(String inclusionPattern); + /** + * Predicate that gets the files matching at least one wildcard pattern. No filter is applied when + * zero wildcard patterns (similar to {@link #all()}. + * @see #matchesPathPattern(String) + */ FilePredicate matchesPathPatterns(String[] inclusionPatterns); + /** + * Predicate that gets the files that do not match the given wildcard pattern. + * @see #matchesPathPattern(String) + */ FilePredicate doesNotMatchPathPattern(String exclusionPattern); + /** + * 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 {@link #all()}. + * @see #matchesPathPattern(String) + */ FilePredicate doesNotMatchPathPatterns(String[] exclusionPatterns); + /** + * if the parameter represents an absolute path for the running environment, then + * returns {@link #hasAbsolutePath(String)}, else {@link #hasRelativePath(String)} + */ FilePredicate hasPath(String s); FilePredicate is(File ioFile); -- cgit v1.2.3