Package com.puppycrawl.tools.checkstyle
Class XpathFileGeneratorAstFilter
java.lang.Object
com.puppycrawl.tools.checkstyle.api.AutomaticBean
com.puppycrawl.tools.checkstyle.XpathFileGeneratorAstFilter
- All Implemented Interfaces:
Configurable
,Contextualizable
,TreeWalkerFilter
Catches
TreeWalkerAuditEvent
and generates corresponding xpath query.
Stores localized messages and xpath queries map inside static variable
for XpathFileGeneratorAuditListener
.
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
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
accept
(TreeWalkerAuditEvent event) Determines whether or not a filteredTreeWalkerAuditEvent
is accepted.static String
Returns xpath query corresponding to localized message of theTreeWalkerAuditEvent
object which points to the same AST element as specifiedAuditEvent
object.protected void
Provides a hook to finish the part of this component's setup that was not handled by the bean introspection.void
setTabWidth
(int tabWidth) Sets tab width.Methods inherited from class com.puppycrawl.tools.checkstyle.api.AutomaticBean
configure, contextualize, getConfiguration, setupChild
-
Constructor Details
-
XpathFileGeneratorAstFilter
public XpathFileGeneratorAstFilter()
-
-
Method Details
-
setTabWidth
public void setTabWidth(int tabWidth) Sets tab width.- Parameters:
tabWidth
- the distance between tab stops
-
findCorrespondingXpathQuery
Returns xpath query corresponding to localized message of theTreeWalkerAuditEvent
object which points to the same AST element as specifiedAuditEvent
object.- Parameters:
event
- theAuditEvent
object.- Returns:
- returns corresponding xpath query
-
finishLocalSetup
protected void finishLocalSetup()Description copied from class:AutomaticBean
Provides 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:
finishLocalSetup
in classAutomaticBean
-
accept
Description copied from interface:TreeWalkerFilter
Determines whether or not a filteredTreeWalkerAuditEvent
is accepted.- Specified by:
accept
in interfaceTreeWalkerFilter
- Parameters:
event
- the TreeWalkerAuditEvent to filter.- Returns:
- true if the event is accepted.
-