Package net.sourceforge.pmd.lang
Class BaseLanguageModule
- java.lang.Object
-
- net.sourceforge.pmd.lang.BaseLanguageModule
-
-
Field Summary
Fields Modifier and Type Field Description protected LanguageVersion
defaultVersion
protected java.util.List<java.lang.String>
extensions
protected java.lang.String
name
protected java.lang.Class<?>
ruleChainVisitorClass
protected java.lang.String
shortName
protected java.lang.String
terseName
protected java.util.Map<java.lang.String,LanguageVersion>
versions
-
Fields inherited from interface net.sourceforge.pmd.lang.Language
LANGUAGE_MODULES_CLASS_NAMES_PROPERTY
-
-
Constructor Summary
Constructors Constructor Description BaseLanguageModule(java.lang.String name, java.lang.String shortName, java.lang.String terseName, java.lang.Class<?> ruleChainVisitorClass, java.lang.String... extensions)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addVersion(java.lang.String version, LanguageVersionHandler languageVersionHandler, boolean isDefault)
int
compareTo(Language o)
boolean
equals(java.lang.Object obj)
LanguageVersion
getDefaultVersion()
Get the current PMD defined default LanguageVersion for this Language.java.util.List<java.lang.String>
getExtensions()
Get the list of file extensions associated with this Language.java.lang.String
getName()
Get the full name of this Language.java.lang.Class<?>
getRuleChainVisitorClass()
Get the RuleChainVisitor implementation class used when visiting the AST structure for this Rules for this Language.java.lang.String
getShortName()
Get the short name of this Language.java.lang.String
getTerseName()
Get the terse name of this Language.LanguageVersion
getVersion(java.lang.String versionName)
Get the LanguageVersion for the version string from this Language.java.util.List<LanguageVersion>
getVersions()
Gets the list of supported LanguageVersion for this Language.boolean
hasExtension(java.lang.String extension)
Returns whether the given Language handles the given file extension.int
hashCode()
boolean
hasVersion(java.lang.String version)
java.lang.String
toString()
-
-
-
Field Detail
-
name
protected java.lang.String name
-
shortName
protected java.lang.String shortName
-
terseName
protected java.lang.String terseName
-
ruleChainVisitorClass
protected java.lang.Class<?> ruleChainVisitorClass
-
extensions
protected java.util.List<java.lang.String> extensions
-
versions
protected java.util.Map<java.lang.String,LanguageVersion> versions
-
defaultVersion
protected LanguageVersion defaultVersion
-
-
Method Detail
-
addVersion
protected void addVersion(java.lang.String version, LanguageVersionHandler languageVersionHandler, boolean isDefault)
-
getName
public java.lang.String getName()
Description copied from interface:Language
Get the full name of this Language. This is generally the name of this Language without the use of acronyms.
-
getShortName
public java.lang.String getShortName()
Description copied from interface:Language
Get the short name of this Language. This is the commonly used short form of this Language's name, perhaps an acronym.- Specified by:
getShortName
in interfaceLanguage
- Returns:
- The short name of this Language.
-
getTerseName
public java.lang.String getTerseName()
Description copied from interface:Language
Get the terse name of this Language. This is used for Rule configuration.- Specified by:
getTerseName
in interfaceLanguage
- Returns:
- The terse name of this Language.
-
getRuleChainVisitorClass
public java.lang.Class<?> getRuleChainVisitorClass()
Description copied from interface:Language
Get the RuleChainVisitor implementation class used when visiting the AST structure for this Rules for this Language.- Specified by:
getRuleChainVisitorClass
in interfaceLanguage
- Returns:
- The RuleChainVisitor class.
- See Also:
RuleChainVisitor
-
getExtensions
public java.util.List<java.lang.String> getExtensions()
Description copied from interface:Language
Get the list of file extensions associated with this Language.- Specified by:
getExtensions
in interfaceLanguage
- Returns:
- List of file extensions.
-
hasExtension
public boolean hasExtension(java.lang.String extension)
Description copied from interface:Language
Returns whether the given Language handles the given file extension. The comparison is done ignoring case.- Specified by:
hasExtension
in interfaceLanguage
- Parameters:
extension
- A file extension.- Returns:
true
if this Language handles this extension,false
otherwise.
-
getVersions
public java.util.List<LanguageVersion> getVersions()
Description copied from interface:Language
Gets the list of supported LanguageVersion for this Language.- Specified by:
getVersions
in interfaceLanguage
- Returns:
- The LanguageVersion for this Language.
-
hasVersion
public boolean hasVersion(java.lang.String version)
- Specified by:
hasVersion
in interfaceLanguage
-
getVersion
public LanguageVersion getVersion(java.lang.String versionName)
Description copied from interface:Language
Get the LanguageVersion for the version string from this Language.- Specified by:
getVersion
in interfaceLanguage
- Parameters:
versionName
- The language version string.- Returns:
- The corresponding LanguageVersion,
null
if the version string is not recognized.
-
getDefaultVersion
public LanguageVersion getDefaultVersion()
Description copied from interface:Language
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.- Specified by:
getDefaultVersion
in interfaceLanguage
- Returns:
- The current default LanguageVersion for this Language.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
-