net.sourceforge.pmd.lang
Class BaseLanguageModule

java.lang.Object
  extended by net.sourceforge.pmd.lang.BaseLanguageModule
All Implemented Interfaces:
Language

public abstract class BaseLanguageModule
extends Object
implements Language

Created by christoferdutz on 21.09.14.


Field Summary
protected  LanguageVersion defaultVersion
           
protected  List<String> extensions
           
protected  String name
           
protected  Class<?> ruleChainVisitorClass
           
protected  String shortName
           
protected  String terseName
           
protected  Map<String,LanguageVersion> versions
           
 
Fields inherited from interface net.sourceforge.pmd.lang.Language
LANGUAGE_MODULES_CLASS_NAMES_PROPERTY
 
Constructor Summary
BaseLanguageModule(String name, String shortName, String terseName, Class<?> ruleChainVisitorClass, String... extensions)
           
 
Method Summary
protected  void addVersion(String version, LanguageVersionHandler languageVersionHandler, boolean isDefault)
           
 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 versionName)
          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)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

name

protected String name

shortName

protected String shortName

terseName

protected String terseName

ruleChainVisitorClass

protected Class<?> ruleChainVisitorClass

extensions

protected List<String> extensions

versions

protected Map<String,LanguageVersion> versions

defaultVersion

protected LanguageVersion defaultVersion
Constructor Detail

BaseLanguageModule

public BaseLanguageModule(String name,
                          String shortName,
                          String terseName,
                          Class<?> ruleChainVisitorClass,
                          String... extensions)
Method Detail

addVersion

protected void addVersion(String version,
                          LanguageVersionHandler languageVersionHandler,
                          boolean isDefault)

getName

public 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.

Specified by:
getName in interface Language
Returns:
The full name of this Language.

getShortName

public 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 interface Language
Returns:
The short name of this Language.

getTerseName

public String getTerseName()
Description copied from interface: Language
Get the terse name of this Language. This is used for Rule configuration.

Specified by:
getTerseName in interface Language
Returns:
The terse name of this Language.

getRuleChainVisitorClass

public 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 interface Language
Returns:
The RuleChainVisitor class.
See Also:
RuleChainVisitor

getExtensions

public List<String> getExtensions()
Description copied from interface: Language
Get the list of file extensions associated with this Language.

Specified by:
getExtensions in interface Language
Returns:
List of file extensions.

hasExtension

public boolean hasExtension(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 interface Language
Parameters:
extension - A file extension.
Returns:
true if this Language handles this extension, false otherwise.

getVersions

public List<LanguageVersion> getVersions()
Description copied from interface: Language
Gets the list of supported LanguageVersion for this Language.

Specified by:
getVersions in interface Language
Returns:
The LanguageVersion for this Language.

hasVersion

public boolean hasVersion(String version)
Specified by:
hasVersion in interface Language

getVersion

public LanguageVersion getVersion(String versionName)
Description copied from interface: Language
Get the LanguageVersion for the version string from this Language.

Specified by:
getVersion in interface Language
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 interface Language
Returns:
The current default LanguageVersion for this Language.

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2002-2015 InfoEther. All Rights Reserved.