Package net.sourceforge.pmd.lang
Class LanguageProcessorRegistry
java.lang.Object
net.sourceforge.pmd.lang.LanguageProcessorRegistry
- All Implemented Interfaces:
AutoCloseable
Stores all currently initialized
LanguageProcessors during analysis.- Author:
- Clément Fournier
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classAn exception that occurs during the closing of aLanguageProcessor, -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Close all processors in this registry.static LanguageProcessorRegistrycreate(LanguageRegistry registry, Map<Language, LanguagePropertyBundle> languageProperties, PmdReporter messageReporter) Create a new instance by creating a processor for each language in the given language registry.static Map<Language,LanguagePropertyBundle> derivePropertiesFromStrings(Map<Language, Properties> stringProperties, PmdReporter reporter) Return the languages that are registered in this instance.@NonNull LanguageProcessorReturn the processor for a given language.static LanguageProcessorRegistrysingleton(@NonNull LanguageProcessor lp) Create a registry with a single language processor.toString()
-
Method Details
-
getLanguages
Return the languages that are registered in this instance. -
getProcessor
Return the processor for a given language.- Parameters:
l- a language- Throws:
IllegalArgumentException- if the language is not part of this registry
-
close
Close all processors in this registry.- Specified by:
closein interfaceAutoCloseable- Throws:
LanguageProcessorRegistry.LanguageTerminationException- If closing any of the processors threw something
-
singleton
Create a registry with a single language processor.- Throws:
IllegalStateException- If the language depends on other languages, as they are then not included in this registry (seeLanguage.getDependencies()).
-
create
public static LanguageProcessorRegistry create(LanguageRegistry registry, Map<Language, LanguagePropertyBundle> languageProperties, PmdReporter messageReporter) Create a new instance by creating a processor for each language in the given language registry. Each processor is created using the property bundle that is in the map, if present. Language properties are defaulted to environment variables if they are not already overridden.- Throws:
IllegalStateException- If any language in the registry depends on languages that are not found in it, or that could not be instantiated (seeLanguage.getDependencies()).IllegalArgumentException- If some entry in the map maps a language to an incompatible property bundle
-
derivePropertiesFromStrings
public static Map<Language,LanguagePropertyBundle> derivePropertiesFromStrings(Map<Language, Properties> stringProperties, PmdReporter reporter) -
toString
-