Package net.sourceforge.pmd.lang
Class LanguageModuleBase
java.lang.Object
net.sourceforge.pmd.lang.LanguageModuleBase
- All Implemented Interfaces:
Comparable<Language>,Language
- Direct Known Subclasses:
CpdOnlyLanguageModuleBase,SimpleDialectLanguageModuleBase,SimpleLanguageModuleBase
Base class for language modules.
- Author:
- Clément Fournier
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classExpresses the language as a dialect of another language.static final classMetadata about a language, basically a builder pattern for the language instance. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedprotectedConstruct a module instance using the given metadata. -
Method Summary
Modifier and TypeMethodDescriptionintboolean@Nullable StringIf this is a dialect of another language, returns the base language.@NonNull LanguageVersionReturns the default language version for this language.Returns a set of the IDs of languages that this language instance depends on.Returns the list of file extensions associated with this language.getId()Returns the ID of this language.getName()Returns the full name of this Language.Returns the short name of this language.getVersion(String version) Returns the language version with the given version string.Returns a complete set of supported version names for this language including all aliases.Returns an ordered list of supported versions for this language.inthashCode()toString()Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface net.sourceforge.pmd.lang.Language
getLatestVersion, hasExtension, hasVersion, isDialectOf, newPropertyBundle
-
Constructor Details
-
LanguageModuleBase
Construct a module instance using the given metadata. The metadata must be properly constructed.- Throws:
IllegalStateException- If the metadata is invalid (eg missing extensions or name or no versions)
-
LanguageModuleBase
- Experimental Status:
- Since 7.13.0. See [core] Support language dialects #5438.
-
-
Method Details
-
getBaseLanguageId
Description copied from interface:LanguageIf this is a dialect of another language, returns the base language. Dialects are for example different flavors of XML. Dialects must share the same AST as their base language. This makes it so that rules written for the base language can be applied files of all dialects uniformly.- Specified by:
getBaseLanguageIdin interfaceLanguage
-
getVersions
Description copied from interface:LanguageReturns an ordered list of supported versions for this language.- Specified by:
getVersionsin interfaceLanguage- Returns:
- All supported language versions.
-
getDefaultVersion
Description copied from interface:LanguageReturns the default language version 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:
getDefaultVersionin interfaceLanguage- Returns:
- The current default language version for this language.
-
getVersion
Description copied from interface:LanguageReturns the language version with the given version string. Returns null if no such version exists.- Specified by:
getVersionin interfaceLanguage- Parameters:
version- A language version string.- Returns:
- The corresponding LanguageVersion,
nullif the version string is not recognized.
-
getVersionNamesAndAliases
Description copied from interface:LanguageReturns a complete set of supported version names for this language including all aliases.- Specified by:
getVersionNamesAndAliasesin interfaceLanguage- Returns:
- All supported language version names and aliases.
-
getDependencies
Description copied from interface:LanguageReturns a set of the IDs of languages that this language instance depends on. Whenever this language is loaded into aLanguageProcessorRegistry, those dependencies need to be loaded as well.- Specified by:
getDependenciesin interfaceLanguage
-
getName
Description copied from interface:LanguageReturns the full name of this Language. This is generally the name of this language without the use of acronyms, but possibly some capital letters, eg"Java". It's suitable for displaying in a GUI. -
getShortName
Description copied from interface:LanguageReturns the short name of this language. This is the commonly used short form of this language's name, perhaps an acronym, but possibly with special characters.- Specified by:
getShortNamein interfaceLanguage- Returns:
- The short name of this language.
-
getId
Description copied from interface:LanguageReturns the ID of this language. This is a short, alphanumeric, lowercase name, eg"java". It's used to identify the language in the ruleset XML, and is also in the package name of the language module. -
getExtensions
Description copied from interface:LanguageReturns the list of file extensions associated with this language. This list is unmodifiable. Extensions do not have a '.' prefix.- Specified by:
getExtensionsin interfaceLanguage- Returns:
- A list of file extensions.
-
toString
-
compareTo
- Specified by:
compareToin interfaceComparable<Language>
-
hashCode
public int hashCode() -
equals
-