Interface Language

  • All Superinterfaces:
    All Known Implementing Classes:

    public interface Language
    extends Comparable<Language>
    Interface each Language implementation has to implement. It is used by the LanguageRegistry 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
    • 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.
        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.
        The short name of this Language.
      • getTerseName

        String getTerseName()
        Get the terse name of this Language. This is used for Rule configuration.
        The terse name of this Language.
      • getExtensions

        List<String> getExtensions()
        Get the list of file extensions associated with this Language.
        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.
        extension - A file extension.
        true if this Language handles this extension, false otherwise.
      • getRuleChainVisitorClass

        Class<?> getRuleChainVisitorClass()
        Will be removed in PMD 7, avoid using this
        Get the RuleChainVisitor implementation class used when visiting the AST structure for this Rules for this Language.
        The RuleChainVisitor class.
        See Also:
      • getVersions

        List<LanguageVersion> getVersions()
        Gets the list of supported LanguageVersion for this Language.
        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.
        version - The language version string.
        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.
        The current default LanguageVersion for this Language.