Package net.sourceforge.pmd.reporting
Interface FileAnalysisListener
- All Superinterfaces:
AutoCloseable
- All Known Implementing Classes:
CloseHookFileListener,Report.ReportBuilderListener
A handler for events occurring during analysis of a single file. Instances
are only used on a single thread for their entire lifetime, so don't
need to be synchronized to access state they own. File listeners are
spawned by a
GlobalAnalysisListener.
Listeners are assumed to be ready to receive events as soon as they are constructed.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptiondefault voidclose()Signals the end of the analysis: no further calls will be made to this listener.static FileAnalysisListenernoop()A listener that does nothing.default voidonError(Report.ProcessingError error) Handle an error that occurred while processing a file.voidonRuleViolation(RuleViolation violation) Handle a new violation (not suppressed).default voidHandle a new suppressed violation.static FileAnalysisListenertee(Collection<? extends FileAnalysisListener> listeners) Produce an analysis listener that forwards all events to the given listeners.
-
Method Details
-
onRuleViolation
Handle a new violation (not suppressed). -
onSuppressedRuleViolation
Handle a new suppressed violation. -
onError
Handle an error that occurred while processing a file. -
close
Signals the end of the analysis: no further calls will be made to this listener. This is run in the thread the listener has been used in. This means, if this routine merges some state into some global state of theGlobalAnalysisListener, then that must be synchronized.- Specified by:
closein interfaceAutoCloseable- Throws:
Exception- If an exception occurs, e.g. 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
-