net.sourceforge.pmd.lang
Enum Language

java.lang.Object
  extended by java.lang.Enum<Language>
      extended by net.sourceforge.pmd.lang.Language
All Implemented Interfaces:
Serializable, Comparable<Language>

public enum Language
extends Enum<Language>

This is an enumeration of the Languages of which PMD is aware. The primary use of a Language is for Rules, but they are also used by utilities such as CPD.

The following are key components of a Language in PMD:

See Also:
LanguageVersion, LanguageVersionDiscoverer

Enum Constant Summary
CPP
           
ECMASCRIPT
           
FORTRAN
           
JAVA
           
JSP
           
PHP
           
RUBY
           
XML
           
XSL
           
 
Method Summary
static String commaSeparatedTerseNames(List<Language> languages)
          Return a comma separated list of Language terse names.
static List<Language> findByExtension(String extension)
          A utility method to find the Languages which are associated with the given file extension.
static Language findByTerseName(String terseName)
          A utility method to find the Language associated with the given terse name, whatever the case is.
static List<Language> findWithRuleSupport()
          A utility method to find the Languages which have Rule support.
static Language getDefaultLanguage()
          Return the default language for PMD.
 LanguageVersion getDefaultVersion()
          Get the current PMD defined default LanguageVersion for this Language.
 List<String> getExtensions()
          Get the list of file extensions associated with this Language.
 String getName()
          Get the full name of this Language.
 Class<?> getRuleChainVisitorClass()
          Get the RuleChainVisitor implementation class used when visiting the AST structure for this Rules for this Language.
 String getShortName()
          Get the short name of this Language.
 String getTerseName()
          Get the terse name of this Language.
 LanguageVersion getVersion(String version)
          Get the LanguageVersion for the version string from this Language.
 List<LanguageVersion> getVersions()
          Gets the list of supported LanguageVersion for this Language.
 boolean hasExtension(String extension)
          Returns whether the given Language handles the given file extension.
 String toString()
          A friendly String form of the Language.
static Language valueOf(String name)
          Returns the enum constant of this type with the specified name.
static Language[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

CPP

public static final Language CPP

FORTRAN

public static final Language FORTRAN

ECMASCRIPT

public static final Language ECMASCRIPT

JAVA

public static final Language JAVA

JSP

public static final Language JSP

PHP

public static final Language PHP

RUBY

public static final Language RUBY

XSL

public static final Language XSL

XML

public static final Language XML
Method Detail

values

public static Language[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (Language c : Language.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static Language valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
IllegalArgumentException - if this enum type has no constant with the specified name
NullPointerException - if the argument is null

getName

public String getName()
Get the full name of this Language. This is generally the name of this Language without the use of acronyms.

Returns:
The full name of this Language.

getShortName

public String getShortName()
Get the short name of this Language. This is the commonly used short form of this Language's name, perhaps an acronym.

Returns:
The short name of this Language.

getTerseName

public String getTerseName()
Get the terse name of this Language. This is used for Rule configuration.

Returns:
The terse name of this Language.

getExtensions

public List<String> getExtensions()
Get the list of file extensions associated with this Language.

Returns:
List of file extensions.

hasExtension

public boolean hasExtension(String extension)
Returns whether the given Language handles the given file extension. The comparison is done ignoring case.

Parameters:
extension - A file extension.
Returns:
true if this Language handles this extension, false otherwise.

getRuleChainVisitorClass

public Class<?> getRuleChainVisitorClass()
Get the RuleChainVisitor implementation class used when visiting the AST structure for this Rules for this Language.

Returns:
The RuleChainVisitor class.
See Also:
RuleChainVisitor

getVersions

public List<LanguageVersion> getVersions()
Gets the list of supported LanguageVersion for this Language.

Returns:
The LanguageVersion for this Language.

getDefaultVersion

public LanguageVersion getDefaultVersion()
Get the current PMD defined default LanguageVersion for this Language. This is an arbitrary choice made by the PMD product, and can change between PMD releases. Every Language has a default version.

Returns:
The current default LanguageVersion for this Language.

getVersion

public LanguageVersion getVersion(String version)
Get the LanguageVersion for the version string from this Language.

Parameters:
version - The language version string.
Returns:
The corresponding LanguageVersion, null if the version string is not recognized.

toString

public String toString()
A friendly String form of the Language.

Overrides:
toString in class Enum<Language>

findWithRuleSupport

public static List<Language> findWithRuleSupport()
A utility method to find the Languages which have Rule support.

Returns:
A List of Languages with Rule support.

findByExtension

public static List<Language> findByExtension(String extension)
A utility method to find the Languages which are associated with the given file extension.

Parameters:
extension - The file extension.
Returns:
A List of Languages which handle the extension.

findByTerseName

public static Language findByTerseName(String terseName)
A utility method to find the Language associated with the given terse name, whatever the case is.

Parameters:
terseName - The Language terse name.
Returns:
The Language with this terse name, null if there is no Language with this terse name.

commaSeparatedTerseNames

public static String commaSeparatedTerseNames(List<Language> languages)
Return a comma separated list of Language terse names.

Parameters:
languages - The languages.
Returns:
Comma separated terse names.

getDefaultLanguage

public static Language getDefaultLanguage()
Return the default language for PMD.

Returns:
the proper default language


Copyright © 2002-2012 InfoEther. All Rights Reserved.