net.sourceforge.pmd.lang
Enum LanguageVersion

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

public enum LanguageVersion
extends Enum<LanguageVersion>

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

The following are key components of a LanguageVersion in PMD:

See Also:
LanguageVersion, LanguageVersionDiscoverer

Enum Constant Summary
CPP
           
ECMASCRIPT
           
FORTRAN
           
JAVA_13
           
JAVA_14
           
JAVA_15
           
JAVA_16
           
JAVA_17
           
JSP
           
PHP
           
RUBY
           
XML
           
XSL
           
 
Method Summary
static String commaSeparatedTerseNames(List<LanguageVersion> languageVersions)
          Return a comma-separated list of LanguageVersion terse names.
static LanguageVersion findByTerseName(String terseName)
          A utility method to find the LanguageVersion associated with the given terse name.
static List<LanguageVersion> findVersionsForLanguageTerseName(String languageTerseName)
          A utility method to find the all version associated with the given terse name.
static LanguageVersion getDefaultVersion()
          Return the default version for PMD.
 Language getLanguage()
          Get the Language for this LanguageVersion.
 LanguageVersionHandler getLanguageVersionHandler()
          Get the LanguageVersionHandler for this LanguageVersion.
 String getName()
          Get the name of this LanguageVersion.
 String getShortName()
          Get the short name of this LanguageVersion.
 String getTerseName()
          Get the terse name of this LanguageVersion.
 String getVersion()
          Get the version String for this LanguageVersion.
 boolean isDefaultVersion()
          Returns if this LanguageVersion is the default version for the Language.
 String toString()
          A friendly String form of the LanguageVersion.
static LanguageVersion valueOf(String name)
          Returns the enum constant of this type with the specified name.
static LanguageVersion[] 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 LanguageVersion CPP

FORTRAN

public static final LanguageVersion FORTRAN

ECMASCRIPT

public static final LanguageVersion ECMASCRIPT

JAVA_13

public static final LanguageVersion JAVA_13

JAVA_14

public static final LanguageVersion JAVA_14

JAVA_15

public static final LanguageVersion JAVA_15

JAVA_16

public static final LanguageVersion JAVA_16

JAVA_17

public static final LanguageVersion JAVA_17

JSP

public static final LanguageVersion JSP

PHP

public static final LanguageVersion PHP

RUBY

public static final LanguageVersion RUBY

XSL

public static final LanguageVersion XSL

XML

public static final LanguageVersion XML
Method Detail

values

public static LanguageVersion[] 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 (LanguageVersion c : LanguageVersion.values())
    System.out.println(c);

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

valueOf

public static LanguageVersion 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

getLanguage

public Language getLanguage()
Get the Language for this LanguageVersion.

Returns:
The Language for this LanguageVersion.

getVersion

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

Returns:
The version String for this LanguageVersion.

getName

public String getName()
Get the name of this LanguageVersion. This is Language name appended with the LanguageVersion version if not an empty String.

Returns:
The name of this LanguageVersion.

getShortName

public String getShortName()
Get the short name of this LanguageVersion. This is Language short name appended with the LanguageVersion version if not an empty String.

Returns:
The short name of this LanguageVersion.

getTerseName

public String getTerseName()
Get the terse name of this LanguageVersion. This is Language terse name appended with the LanguageVersion version if not an empty String.

Returns:
The terse name of this LanguageVersion.

getLanguageVersionHandler

public LanguageVersionHandler getLanguageVersionHandler()
Get the LanguageVersionHandler for this LanguageVersion.

Returns:
The LanguageVersionHandler for this LanguageVersion.

isDefaultVersion

public boolean isDefaultVersion()
Returns if this LanguageVersion is the default version for the Language.

Returns:
true if this is the default version for the Language, false otherwise.

toString

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

Overrides:
toString in class Enum<LanguageVersion>

findByTerseName

public static LanguageVersion findByTerseName(String terseName)
A utility method to find the LanguageVersion associated with the given terse name.

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

findVersionsForLanguageTerseName

public static List<LanguageVersion> findVersionsForLanguageTerseName(String languageTerseName)
A utility method to find the all version associated with the given terse name.

Parameters:
languageTerseName - The LanguageVersion terse name.
Returns:
A list of versions associated with the terse name.

commaSeparatedTerseNames

public static String commaSeparatedTerseNames(List<LanguageVersion> languageVersions)
Return a comma-separated list of LanguageVersion terse names.

Parameters:
languageVersions - The language versions.
Returns:
Comma-separated terse names.

getDefaultVersion

public static LanguageVersion getDefaultVersion()
Return the default version for PMD.

Returns:
the proper instance of LanguageVersion


Copyright © 2002-2012 InfoEther. All Rights Reserved.