Package net.sourceforge.pmd.lang
Interface Language
-
- All Superinterfaces:
Comparable<Language>
- All Known Implementing Classes:
BaseLanguageModule
public interface Language extends Comparable<Language>
Interface each Language implementation has to implement. It is used by the LanguageRregistry to access constants and implementation classes in order to provide support for the language.The following are key components of a Language in PMD:
- Name - Full name of the Language
- Short name - The common short form of the Language
- Terse name - The shortest and simplest possible form of the Language name, generally used for Rule configuration
- Extensions - File extensions associated with the Language
- Rule Chain Visitor - The RuleChainVisitor implementation used for this Language
- Versions - The LanguageVersions associated with the Language
- See Also:
LanguageVersion
,LanguageVersionDiscoverer
-
-
Field Summary
Fields Modifier and Type Field Description static String
LANGUAGE_MODULES_CLASS_NAMES_PROPERTY
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description 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.boolean
hasVersion(String version)
-
Methods inherited from interface java.lang.Comparable
compareTo
-
-
-
-
Field Detail
-
LANGUAGE_MODULES_CLASS_NAMES_PROPERTY
static final String LANGUAGE_MODULES_CLASS_NAMES_PROPERTY
- See Also:
- Constant Field Values
-
-
Method Detail
-
getName
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
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
String getTerseName()
Get the terse name of this Language. This is used for Rule configuration.- Returns:
- The terse name of this Language.
-
getExtensions
List<String> getExtensions()
Get the list of file extensions associated with this Language.- Returns:
- List of file extensions.
-
hasExtension
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
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
List<LanguageVersion> getVersions()
Gets the list of supported LanguageVersion for this Language.- Returns:
- The LanguageVersion for this Language.
-
hasVersion
boolean hasVersion(String version)
-
getVersion
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.
-
getDefaultVersion
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.
-
-