Package net.sourceforge.pmd.reporting
Interface ListenerInitializer
-
- All Superinterfaces:
AutoCloseable
public interface ListenerInitializer extends AutoCloseable
An initializer forGlobalAnalysisListenerthat 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 thatclose()is called last, and beforeGlobalAnalysisListener.startFileAnalysis(TextFile)is called for the first time.
-
-
Method Summary
All Methods Static Methods Instance Methods Default Methods Modifier and Type Method Description default 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 Detail
-
setNumberOfFilesToAnalyze
default void setNumberOfFilesToAnalyze(int totalFiles)
Notifies the total number of files collected for analysis.
-
setFilesToAnalyze
default void setFilesToAnalyze(List<FileId> files)
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
default void setFileNameRenderer(FileNameRenderer fileNameRenderer)
Notify this listener that the givenFileNameRendererwill be used by default for this analysis. This is mostly only relevant forRendererlisteners.- Parameters:
fileNameRenderer- The renderer
-
close
default void close() throws ExceptionSignals 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
static ListenerInitializer noop()
A listener that does nothing.
-
tee
static ListenerInitializer tee(Collection<? extends ListenerInitializer> listeners)
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
-
-