aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-plugin-api
diff options
context:
space:
mode:
authorsimonbrandhof <simon.brandhof@gmail.com>2011-03-11 15:31:53 +0100
committersimonbrandhof <simon.brandhof@gmail.com>2011-03-11 16:03:29 +0100
commit8a8757f094b6cf9ad497839224241d289c2a2ab5 (patch)
treebcc17ffdd58b60bcb8d3f0da7d451f6763981cf3 /sonar-plugin-api
parent217733b989c6f5a23eb86be7de4d490eb983f880 (diff)
downloadsonarqube-8a8757f094b6cf9ad497839224241d289c2a2ab5.tar.gz
sonarqube-8a8757f094b6cf9ad497839224241d289c2a2ab5.zip
API: add method Java#isJavaFile(java.io.File)
Diffstat (limited to 'sonar-plugin-api')
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/resources/Java.java7
1 files changed, 7 insertions, 0 deletions
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/resources/Java.java b/sonar-plugin-api/src/main/java/org/sonar/api/resources/Java.java
index 1081d449f4d..72de8a0fb4b 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/resources/Java.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/resources/Java.java
@@ -19,6 +19,9 @@
*/
package org.sonar.api.resources;
+import org.apache.commons.lang.ArrayUtils;
+import org.apache.commons.lang.StringUtils;
+
/**
* Java language implementation
*
@@ -57,4 +60,8 @@ public class Java extends AbstractLanguage {
return SUFFIXES;
}
+ public static boolean isJavaFile(java.io.File file) {
+ String suffix = StringUtils.substringAfterLast(file.getName(), ".");
+ return ArrayUtils.contains(SUFFIXES, suffix);
+ }
}