aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorVladislav Lisetskiy <vladlis54@gmail.com>2015-11-03 20:26:25 +0300
committerRoman Ivanov <ivanov-jr@mail.ru>2015-11-03 14:18:26 -0800
commit79e2149b37d91efaaeee891b491a3a9e0dfb6ac2 (patch)
tree0f087827972f9b399109ac98e57debfc30fb35b7 /src
parent986b2c664bb92c5bb7f19483fcac7db23000e6df (diff)
downloadcheckstyle-79e2149b37d91efaaeee891b491a3a9e0dfb6ac2.tar.gz
Issue #2346: Describe token sets in 'writing checks' section in xdoc
Diffstat (limited to 'src')
-rw-r--r--src/xdocs/writingchecks.xml.vm42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/xdocs/writingchecks.xml.vm b/src/xdocs/writingchecks.xml.vm
index f4ef107ff..ee12fc8d6 100644
--- a/src/xdocs/writingchecks.xml.vm
+++ b/src/xdocs/writingchecks.xml.vm
@@ -272,6 +272,48 @@ public class MethodLimitCheck extends Check
</section>
+ <section name="Understanding token sets">
+
+ <p>
+ There are four methods in Check class to control the processed
+ <a href="http://checkstyle.sourceforge.net/apidocs/index.html">TokenTypes</a> -
+ one setter
+ <a href="http://checkstyle.sourceforge.net/apidocs/com/puppycrawl/tools/checkstyle/api/Check.html#setTokens-java.lang.String...-">
+ setTokens()</a>, which is used to define a custom set (which is different
+ from the default one) of the processed TokenTypes via config file and
+ three getters, which have to be overridden:
+ <a href="http://checkstyle.sourceforge.net/apidocs/com/puppycrawl/tools/checkstyle/api/Check.html#getDefaultTokens--">
+ getDefaultTokens()</a>,
+ <a href="http://checkstyle.sourceforge.net/apidocs/com/puppycrawl/tools/checkstyle/api/Check.html#getAcceptableTokens--">
+ getAcceptableTokens()</a>,
+ <a href="http://checkstyle.sourceforge.net/apidocs/com/puppycrawl/tools/checkstyle/api/Check.html#getRequiredTokens--">
+ getRequiredTokens()</a>.
+ </p>
+
+ <ul>
+
+ <li>
+ getDefaultTokens() - returns a set of TokenTypes which are processed in
+ <a href="http://checkstyle.sourceforge.net/apidocs/com/puppycrawl/tools/checkstyle/api/Check.html#visitToken-com.puppycrawl.tools.checkstyle.api.DetailAST-">
+ visitToken()</a> method by default.
+ </li>
+
+ <li>
+ getRequiredTokens() - returns a set of TokenTypes which Check must be subscribed to for
+ a valid execution. If the user wants to specify a custom set of TokenTypes then
+ this set must contain all the TokenTypes from RequiredTokens.
+ </li>
+
+ <li>
+ getAcceptableTokens() - returns a set, which contains all the TokenTypes that
+ can be processed by the check. Both DefaultTokens and RequiredTokens and any custom
+ set of TokenTypes are subsets of AcceptableTokens.
+ </li>
+
+ </ul>
+
+ </section>
+
<section name="Navigating the AST">
<p>