001 /* 002 * SonarQube, open source software quality management tool. 003 * Copyright (C) 2008-2014 SonarSource 004 * mailto:contact AT sonarsource DOT com 005 * 006 * SonarQube is free software; you can redistribute it and/or 007 * modify it under the terms of the GNU Lesser General Public 008 * License as published by the Free Software Foundation; either 009 * version 3 of the License, or (at your option) any later version. 010 * 011 * SonarQube is distributed in the hope that it will be useful, 012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 014 * Lesser General Public License for more details. 015 * 016 * You should have received a copy of the GNU Lesser General Public License 017 * along with this program; if not, write to the Free Software Foundation, 018 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 019 */ 020 021 package org.sonar.api.resources; 022 023 import org.apache.commons.lang.ArrayUtils; 024 import org.apache.commons.lang.StringUtils; 025 026 /** 027 * Java language implementation 028 * This class have been moved in the plugin sonar-java 029 * 030 * @since 1.10 031 * @deprecated in 3.6 032 */ 033 @Deprecated 034 public class Java extends AbstractLanguage { 035 036 public static final Java INSTANCE = new Java(); 037 038 /** 039 * Java key 040 */ 041 public static final String KEY = "java"; 042 043 /** 044 * Java name 045 */ 046 public static final String NAME = "Java"; 047 048 /** 049 * Default package name for classes without package def 050 */ 051 public static final String DEFAULT_PACKAGE_NAME = "[default]"; 052 053 /** 054 * Java files knows suffixes 055 */ 056 public static final String[] SUFFIXES = {".java", ".jav"}; 057 058 /** 059 * Default constructor 060 */ 061 public Java() { 062 super(KEY, NAME); 063 } 064 065 /** 066 * {@inheritDoc} 067 * 068 * @see AbstractLanguage#getFileSuffixes() 069 */ 070 public String[] getFileSuffixes() { 071 return SUFFIXES; 072 } 073 074 public static boolean isJavaFile(java.io.File file) { 075 String suffix = "." + StringUtils.lowerCase(StringUtils.substringAfterLast(file.getName(), ".")); 076 return ArrayUtils.contains(SUFFIXES, suffix); 077 } 078 079 }