Package net.sourceforge.pmd.reporting
Interface ListenerInitializer
- All Superinterfaces:
AutoCloseable
An initializer for
GlobalAnalysisListener that gets notified of
general analysis parameters.
Each method will be called exactly once, before any events on the
GlobalAnalysisListener. The order of calls is unspecified,
except that close() is called last, and before
GlobalAnalysisListener.startFileAnalysis(TextFile) is called
for the first time.
-
Method Summary
Modifier and TypeMethodDescriptiondefault voidclose()Signals the end of initialization: no further calls will be made to this object.static ListenerInitializernoop()A listener that does nothing.default voidsetFileNameRenderer(FileNameRenderer fileNameRenderer) Notify this listener that the givenFileNameRendererwill be used by default for this analysis.default voidsetFilesToAnalyze(List<FileId> files) Set the list of files that will be analyzed during this analysis.default voidsetNumberOfFilesToAnalyze(int totalFiles) Notifies the total number of files collected for analysis.static ListenerInitializertee(Collection<? extends ListenerInitializer> listeners) Produce an analysis listener that forwards all events to the given listeners.
-
Method Details
-
setNumberOfFilesToAnalyze
default void setNumberOfFilesToAnalyze(int totalFiles) Notifies the total number of files collected for analysis. -
setFilesToAnalyze
Set the list of files that will be analyzed during this analysis. Renderers must output each file in this order. Multithreaded processing might however pass them to the renderer in any order. Renderers may useDeterministicOutputListenerWrapperto reorder the events.- Since:
- 7.12.0
-
setFileNameRenderer
Notify this listener that the givenFileNameRendererwill be used by default for this analysis. This is mostly only relevant forRendererlisteners.- Parameters:
fileNameRenderer- The renderer
-
close
Signals the end of initialization: no further calls will be made to this object.- Specified by:
closein interfaceAutoCloseable- Throws:
Exception- If an exception occurs, eg IOException when writing to a renderer
-
noop
A listener that does nothing. -
tee
Produce an analysis listener that forwards all events to the given listeners.- Parameters:
listeners- Listeners- Returns:
- A new listener
- Throws:
IllegalArgumentException- If the parameter is emptyNullPointerException- If the parameter or any of its elements is null
-