001/*
002 * SonarQube
003 * Copyright (C) 2009-2016 SonarSource SA
004 * mailto:contact AT sonarsource DOT com
005 *
006 * This program 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 * This program 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 */
020package org.sonar.api.resources;
021
022import org.apache.commons.lang.ArrayUtils;
023import org.apache.commons.lang.StringUtils;
024
025/**
026 * Java language implementation
027 * This class have been moved in the plugin sonar-java
028 *
029 * @since 1.10
030 * @deprecated in 3.6
031 */
032@Deprecated
033public class Java extends AbstractLanguage {
034
035  public static final Java INSTANCE = new Java();
036
037  /**
038   * Java key
039   */
040  public static final String KEY = "java";
041
042  /**
043   * Java name
044   */
045  public static final String NAME = "Java";
046
047  /**
048   * Default package name for classes without package def
049   */
050  public static final String DEFAULT_PACKAGE_NAME = "[default]";
051
052  /**
053   * Java files knows suffixes
054   */
055  public static final String[] SUFFIXES = {".java", ".jav"};
056
057  /**
058   * Default constructor
059   */
060  public Java() {
061    super(KEY, NAME);
062  }
063
064  /**
065   * {@inheritDoc}
066   *
067   * @see AbstractLanguage#getFileSuffixes()
068   */
069  @Override
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}