aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-plugin-api
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@gmail.com>2014-03-14 12:41:20 +0100
committerSimon Brandhof <simon.brandhof@gmail.com>2014-03-14 12:44:24 +0100
commit69376773bc12d598e625bc3030abff289f9194f3 (patch)
tree6f757fa80daf71e664076d247260ba6b9014cec1 /sonar-plugin-api
parent4149bcb700a85338effe3d9efe94354467af7207 (diff)
downloadsonarqube-69376773bc12d598e625bc3030abff289f9194f3.tar.gz
sonarqube-69376773bc12d598e625bc3030abff289f9194f3.zip
SONAR-4790 complete documentation of FileSystem
Diffstat (limited to 'sonar-plugin-api')
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/FileSystem.java16
1 files changed, 15 insertions, 1 deletions
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/FileSystem.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/FileSystem.java
index b362d151206..5172eb8d542 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/FileSystem.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/FileSystem.java
@@ -82,6 +82,13 @@ public interface FileSystem extends BatchComponent {
* Returns the single element matching the predicate. If more than one elements match
* the predicate, then {@link IllegalArgumentException} is thrown. Returns {@code null}
* if no files match.
+ *
+ * <p/>
+ * How to use :
+ * <pre>
+ * InputFile file = fs.inputFile(fs.predicates().hasRelativePath("src/Foo.php"));
+ * </pre>
+ *
* @see #predicates()
*/
@CheckForNull
@@ -91,9 +98,16 @@ public interface FileSystem extends BatchComponent {
* Input files matching the given attributes. Return all the files if the parameter
* <code>attributes</code> is empty.
* <p/>
- * Important - result is an {@link java.lang.Iterable} to benefit from streaming and decreasing
+ * <b>Important</b> - result is an {@link java.lang.Iterable} to benefit from streaming and decreasing
* memory consumption. It should be iterated only once, else copy it into a list :
* {@code com.google.common.collect.Lists.newArrayList(inputFiles(predicate))}
+ * <p/>
+ * How to use :
+ * <pre>
+ * FilePredicates p = fs.predicates();
+ * Iterable<InputFile> files = fs.inputFiles(p.and(p.hasLanguage("java"), p.hasType(InputFile.Type.MAIN)));
+ * </pre>
+ *
* @see #predicates()
*/
Iterable<InputFile> inputFiles(FilePredicate predicate);