From 8a8757f094b6cf9ad497839224241d289c2a2ab5 Mon Sep 17 00:00:00 2001 From: simonbrandhof Date: Fri, 11 Mar 2011 15:31:53 +0100 Subject: API: add method Java#isJavaFile(java.io.File) --- sonar-plugin-api/src/main/java/org/sonar/api/resources/Java.java | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'sonar-plugin-api') 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); + } } -- cgit v1.2.3