Package com.puppycrawl.tools.checkstyle
Class XpathFileGeneratorAuditListener
- java.lang.Object
-
- com.puppycrawl.tools.checkstyle.api.AutomaticBean
-
- com.puppycrawl.tools.checkstyle.XpathFileGeneratorAuditListener
-
- All Implemented Interfaces:
AuditListener,Configurable,Contextualizable,java.util.EventListener
public class XpathFileGeneratorAuditListener extends AutomaticBean implements AuditListener
Generates suppressions.xml file, based on violations occurred. See issue #102 https://github.com/checkstyle/checkstyle/issues/102
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.puppycrawl.tools.checkstyle.api.AutomaticBean
AutomaticBean.OutputStreamOptions
-
-
Field Summary
Fields Modifier and Type Field Description private booleancloseStreamClose output stream in auditFinished.private booleanisXmlHeaderPrintedDetermines if xml header is printed.private static java.lang.StringQUOTE_CHARThe " quote character.private java.io.PrintWriterwriterHelper writer that allows easy encoding and printing.
-
Constructor Summary
Constructors Constructor Description XpathFileGeneratorAuditListener(java.io.OutputStream out, AutomaticBean.OutputStreamOptions outputStreamOptions)Creates a newSuppressionFileGeneratorinstance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddError(AuditEvent event)Notify that an audit error was discovered on a specific file.voidaddException(AuditEvent event, java.lang.Throwable throwable)Notify that an exception happened while performing audit.voidauditFinished(AuditEvent event)Notify that the audit is finished.voidauditStarted(AuditEvent event)Notify that the audit is about to start.voidfileFinished(AuditEvent event)Notify that audit is finished on a specific file.voidfileStarted(AuditEvent event)Notify that audit is about to start on a specific file.protected voidfinishLocalSetup()Provides a hook to finish the part of this component's setup that was not handled by the bean introspection.private voidprintXmlHeader()Prints XML header if only it was not printed before.-
Methods inherited from class com.puppycrawl.tools.checkstyle.api.AutomaticBean
configure, contextualize, getConfiguration, setupChild
-
-
-
-
Field Detail
-
QUOTE_CHAR
private static final java.lang.String QUOTE_CHAR
The " quote character.- See Also:
- Constant Field Values
-
writer
private final java.io.PrintWriter writer
Helper writer that allows easy encoding and printing.
-
closeStream
private final boolean closeStream
Close output stream in auditFinished.
-
isXmlHeaderPrinted
private boolean isXmlHeaderPrinted
Determines if xml header is printed.
-
-
Constructor Detail
-
XpathFileGeneratorAuditListener
public XpathFileGeneratorAuditListener(java.io.OutputStream out, AutomaticBean.OutputStreamOptions outputStreamOptions)
Creates a newSuppressionFileGeneratorinstance. Sets the output to a defined stream.- Parameters:
out- the output streamoutputStreamOptions- ifCLOSEstream should be closed in auditFinished()
-
-
Method Detail
-
auditStarted
public void auditStarted(AuditEvent event)
Description copied from interface:AuditListenerNotify that the audit is about to start.- Specified by:
auditStartedin interfaceAuditListener- Parameters:
event- the event details
-
auditFinished
public void auditFinished(AuditEvent event)
Description copied from interface:AuditListenerNotify that the audit is finished.- Specified by:
auditFinishedin interfaceAuditListener- Parameters:
event- the event details
-
fileStarted
public void fileStarted(AuditEvent event)
Description copied from interface:AuditListenerNotify that audit is about to start on a specific file.- Specified by:
fileStartedin interfaceAuditListener- Parameters:
event- the event details
-
fileFinished
public void fileFinished(AuditEvent event)
Description copied from interface:AuditListenerNotify that audit is finished on a specific file.- Specified by:
fileFinishedin interfaceAuditListener- Parameters:
event- the event details
-
addError
public void addError(AuditEvent event)
Description copied from interface:AuditListenerNotify that an audit error was discovered on a specific file.- Specified by:
addErrorin interfaceAuditListener- Parameters:
event- the event details
-
addException
public void addException(AuditEvent event, java.lang.Throwable throwable)
Description copied from interface:AuditListenerNotify that an exception happened while performing audit.- Specified by:
addExceptionin interfaceAuditListener- Parameters:
event- the event detailsthrowable- details of the exception
-
printXmlHeader
private void printXmlHeader()
Prints XML header if only it was not printed before.
-
finishLocalSetup
protected void finishLocalSetup()
Description copied from class:AutomaticBeanProvides a hook to finish the part of this component's setup that was not handled by the bean introspection.The default implementation does nothing.
- Specified by:
finishLocalSetupin classAutomaticBean
-
-