Class LanguageRegistry


  • public final class LanguageRegistry
    extends net.sourceforge.pmd.internal.LanguageServiceBase<Language>
    Provides access to the registered PMD languages. These are found from the classpath of the ClassLoader of this class.
    • Method Detail

      • getInstance

        @Deprecated
        public static LanguageRegistry getInstance()
        Deprecated.
        Use the static methods instead, will be made private
      • getLanguages

        public static Set<Language> getLanguages()
        Returns a set of all the known languages. The ordering of the languages is by terse name.
      • getLanguage

        public static Language getLanguage​(String languageName)
        Returns a language from its full name (eg "Java"). This is case sensitive.
        Parameters:
        languageName - Language name
        Returns:
        A language, or null if the name is unknown
      • getDefaultLanguage

        public static Language getDefaultLanguage()
        Returns a "default language" known to the service loader. This is the Java language if available, otherwise an arbitrary one. If no languages are loaded, returns null.
        Returns:
        A language, or null if the name is unknown
      • findLanguageByTerseName

        public static Language findLanguageByTerseName​(String terseName)
        Returns a language from its terse name (eg "java"). This is case sensitive.
        Parameters:
        terseName - Language terse name
        Returns:
        A language, or null if the name is unknown
      • findByExtension

        public static List<Language> findByExtension​(String extensionWithoutDot)
        Returns all languages that support the given extension.
        Parameters:
        extensionWithoutDot - A file extension (without '.' prefix)