Interface ListenerInitializer

All Superinterfaces:
AutoCloseable

public interface ListenerInitializer extends 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 Details

    • 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 use DeterministicOutputListenerWrapper to reorder the events.
      Since:
      7.12.0
    • setFileNameRenderer

      default void setFileNameRenderer(FileNameRenderer fileNameRenderer)
      Notify this listener that the given FileNameRenderer will be used by default for this analysis. This is mostly only relevant for Renderer listeners.
      Parameters:
      fileNameRenderer - The renderer
    • close

      default void close() throws Exception
      Signals the end of initialization: no further calls will be made to this object.
      Specified by:
      close in interface AutoCloseable
      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 empty
      NullPointerException - If the parameter or any of its elements is null