Package com.puppycrawl.tools.checkstyle
Class XpathFileGeneratorAstFilter
java.lang.Object
com.puppycrawl.tools.checkstyle.AbstractAutomaticBean
com.puppycrawl.tools.checkstyle.XpathFileGeneratorAstFilter
- All Implemented Interfaces:
Configurable,Contextualizable,TreeWalkerFilter
Catches
TreeWalkerAuditEvent and generates corresponding xpath query.
Stores violations and xpath queries map inside static variable
for XpathFileGeneratorAuditListener.
See issue #102-
Nested Class Summary
Nested classes/interfaces inherited from class com.puppycrawl.tools.checkstyle.AbstractAutomaticBean
AbstractAutomaticBean.OutputStreamOptions -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanaccept(TreeWalkerAuditEvent event) Determines whether or not a filteredTreeWalkerAuditEventis accepted.static StringReturns xpath query corresponding to violation of theTreeWalkerAuditEventobject which points to the same AST element as specifiedAuditEventobject.protected voidProvides a hook to finish the part of this component's setup that was not handled by the bean introspection.voidsetTabWidth(int tabWidth) Sets tab width.Methods inherited from class com.puppycrawl.tools.checkstyle.AbstractAutomaticBean
configure, contextualize, getConfiguration, setupChild
-
Field Details
-
DELIMITER
The delimiter between xpath queries.- See Also:
-
MESSAGE_QUERY_MAP
Map fromViolationobjects to xpath queries. -
tabWidth
The distance between tab stop position.
-
-
Constructor Details
-
XpathFileGeneratorAstFilter
public XpathFileGeneratorAstFilter()
-
-
Method Details
-
setTabWidth
Sets tab width.- Parameters:
tabWidth- the distance between tab stops
-
findCorrespondingXpathQuery
Returns xpath query corresponding to violation of theTreeWalkerAuditEventobject which points to the same AST element as specifiedAuditEventobject.- Parameters:
event- theAuditEventobject.- Returns:
- returns corresponding xpath query
-
finishLocalSetup
Description copied from class:AbstractAutomaticBeanProvides 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 classAbstractAutomaticBean
-
accept
Description copied from interface:TreeWalkerFilterDetermines whether or not a filteredTreeWalkerAuditEventis accepted.- Specified by:
acceptin interfaceTreeWalkerFilter- Parameters:
event- the TreeWalkerAuditEvent to filter.- Returns:
- true if the event is accepted.
-