Package net.sourceforge.pmd.reporting
Class CloseHookFileListener<T extends FileAnalysisListener>
java.lang.Object
net.sourceforge.pmd.reporting.CloseHookFileListener<T>
- Type Parameters:
T- Type of the delegate
- All Implemented Interfaces:
AutoCloseable,FileAnalysisListener
public abstract class CloseHookFileListener<T extends FileAnalysisListener>
extends Object
implements FileAnalysisListener
A delegating listener wrapper that can override the closing behavior.
- Since:
- 7.12.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal voidclose()Signals the end of the analysis: no further calls will be made to this listener.protected abstract voidPerform a close action.voidonError(Report.ProcessingError error) Handle an error that occurred while processing a file.voidonRuleViolation(RuleViolation violation) Handle a new violation (not suppressed).voidHandle a new suppressed violation.toString()
-
Constructor Details
-
CloseHookFileListener
-
-
Method Details
-
onRuleViolation
Description copied from interface:FileAnalysisListenerHandle a new violation (not suppressed).- Specified by:
onRuleViolationin interfaceFileAnalysisListener
-
onSuppressedRuleViolation
Description copied from interface:FileAnalysisListenerHandle a new suppressed violation.- Specified by:
onSuppressedRuleViolationin interfaceFileAnalysisListener
-
onError
Description copied from interface:FileAnalysisListenerHandle an error that occurred while processing a file.- Specified by:
onErrorin interfaceFileAnalysisListener
-
close
Description copied from interface:FileAnalysisListenerSignals 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- Specified by:
closein interfaceFileAnalysisListener- Throws:
Exception- If an exception occurs, e.g. IOException when writing to a renderer
-
toString
-
doClose
Perform a close action. The delegate is given as a parameter, it has already been closed.- Parameters:
delegate- The delegatee- Exception thrown by the delegate when it was closed, or null if it did not throw. The implementation can choose to rethrow that exception or suppress it.- Throws:
Exception
-