Class LanguageModuleBase

java.lang.Object
net.sourceforge.pmd.lang.LanguageModuleBase
All Implemented Interfaces:
Comparable<Language>, Language
Direct Known Subclasses:
CpdOnlyLanguageModuleBase, SimpleDialectLanguageModuleBase, SimpleLanguageModuleBase

public abstract class LanguageModuleBase extends Object implements Language
Base class for language modules.
Author:
Clément Fournier
  • Constructor Details

  • Method Details

    • getBaseLanguageId

      public @Nullable String getBaseLanguageId()
      Description copied from interface: Language
      If 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:
      getBaseLanguageId in interface Language
    • getVersions

      public List<LanguageVersion> getVersions()
      Description copied from interface: Language
      Returns an ordered list of supported versions for this language.
      Specified by:
      getVersions in interface Language
      Returns:
      All supported language versions.
    • getDefaultVersion

      public @NonNull LanguageVersion getDefaultVersion()
      Description copied from interface: Language
      Returns 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:
      getDefaultVersion in interface Language
      Returns:
      The current default language version for this language.
    • getVersion

      public LanguageVersion getVersion(String version)
      Description copied from interface: Language
      Returns the language version with the given version string. Returns null if no such version exists.
      Specified by:
      getVersion in interface Language
      Parameters:
      version - A language version string.
      Returns:
      The corresponding LanguageVersion, null if the version string is not recognized.
    • getVersionNamesAndAliases

      public Set<String> getVersionNamesAndAliases()
      Description copied from interface: Language
      Returns a complete set of supported version names for this language including all aliases.
      Specified by:
      getVersionNamesAndAliases in interface Language
      Returns:
      All supported language version names and aliases.
    • getDependencies

      public Set<String> getDependencies()
      Description copied from interface: Language
      Returns a set of the IDs of languages that this language instance depends on. Whenever this language is loaded into a LanguageProcessorRegistry, those dependencies need to be loaded as well.
      Specified by:
      getDependencies in interface Language
    • getName

      public String getName()
      Description copied from interface: Language
      Returns 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.
      Specified by:
      getName in interface Language
      Returns:
      The full name of this language.
    • getShortName

      public String getShortName()
      Description copied from interface: Language
      Returns 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:
      getShortName in interface Language
      Returns:
      The short name of this language.
    • getId

      public String getId()
      Description copied from interface: Language
      Returns 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.
      Specified by:
      getId in interface Language
      Returns:
      The ID of this language.
    • getExtensions

      public @NonNull List<String> getExtensions()
      Description copied from interface: Language
      Returns the list of file extensions associated with this language. This list is unmodifiable. Extensions do not have a '.' prefix.
      Specified by:
      getExtensions in interface Language
      Returns:
      A list of file extensions.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • compareTo

      public int compareTo(Language o)
      Specified by:
      compareTo in interface Comparable<Language>
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object