Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.puppycrawl.tools.checkstyle.checks.coding
Class IllegalTokenTextCheck

    java.lang.Object
      com.puppycrawl.tools.checkstyle.api.AutomaticBean
          com.puppycrawl.tools.checkstyle.api.AbstractViolationReporter
              com.puppycrawl.tools.checkstyle.api.Check
                  com.puppycrawl.tools.checkstyle.checks.AbstractFormatCheck
                      com.puppycrawl.tools.checkstyle.checks.coding.IllegalTokenTextCheck

All Implemented Interfaces:
  Configurable, Contextualizable

    public class IllegalTokenTextCheck

extends AbstractFormatCheck

Checks for illegal token text.

An example of how to configure the check to forbid String literals containing `"a href"` is:

     <module name="IllegalTokenText">
         <property name="tokens" value="STRING_LITERAL"/>
         <property name="format" value="a href"/>
     </module>

An example of how to configure the check to forbid leading zeros in an integer literal, other than zero and a hex literal is:

     <module name="IllegalTokenText">
         <property name="tokens" value="NUM_INT,NUM_LONG"/>
         <property name="format" value="^0[^lx]"/>
         <property name="ignoreCase" value="true"/>
     </module>

Author:
  Rick Giles

Constructor Summary
`IllegalTokenTextCheck()` Instantiates a new instance.

Method Summary
`void` | `beginTree(DetailAST aRootAST)` Called before the starting to process a tree.
`int[]` | `getAcceptableTokens()` The configurable token set.
`int[]` | `getDefaultTokens()` Returns the default token a check is interested in.
`String` | `getMessage()` Getter for message property.
`void` | `setIgnoreCase(boolean aCaseInsensitive)` Set whether or not the match is case sensitive.
`void` | `setMessage(String aMessage)` Setter for message property.
`void` | `visitToken(DetailAST aAST)` Called to process a token.

Methods inherited from class com.puppycrawl.tools.checkstyle.checks.AbstractFormatCheck
`getFormat, getRegexp, setCompileFlags, setFormat`

Methods inherited from class com.puppycrawl.tools.checkstyle.api.Check
`destroy, finishTree, getClassLoader, getFileContents, getLines, getRequiredTokens, getTabWidth, getTokenNames, init, leaveToken, log, log, setClassLoader, setFileContents, setMessages, setTabWidth, setTokens`

Methods inherited from class com.puppycrawl.tools.checkstyle.api.AbstractViolationReporter
`getCustomMessages, getId, getMessageBundle, getSeverity, getSeverityLevel, log, setId, setSeverity`

Methods inherited from class com.puppycrawl.tools.checkstyle.api.AutomaticBean
`configure, contextualize, finishLocalSetup, getConfiguration, setupChild`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### IllegalTokenTextCheck

    public IllegalTokenTextCheck()

  Instantiates a new instance.

Method Detail

### beginTree

    public void beginTree(DetailAST aRootAST)

  Description copied from class: `Check`
  Called before the starting to process a tree. Ideal place to initialise information that is to be collected whilst processing a tree.

  Overrides:
    `beginTree` in class `Check`
  Parameters:
    `aRootAST` - the root of the tree

### getDefaultTokens

    public int[] getDefaultTokens()

  Description copied from class: `Check`
  Returns the default token a check is interested in. Only used if the configuration for a check does not define the tokens.

  Specified by:
    `getDefaultTokens` in class `Check`
  Returns:
    the default tokens
  See Also:
    `TokenTypes`

### getAcceptableTokens

    public int[] getAcceptableTokens()

  Description copied from class: `Check`
  The configurable token set. Used to protect Checks against malicious users who specify an unacceptable token set in the configuration file. The default implementation returns the check's default tokens.

  Overrides:
    `getAcceptableTokens` in class `Check`
  Returns:
    the token set this check is designed for.
  See Also:
    `TokenTypes`

### visitToken

    public void visitToken(DetailAST aAST)

  Description copied from class: `Check`
  Called to process a token.

  Overrides:
    `visitToken` in class `Check`
  Parameters:
    `aAST` - the token to process

### setMessage

    public void setMessage(String aMessage)

  Setter for message property.

  Parameters:
    `aMessage` - custom message which should be used to report about violations.

### getMessage

    public String getMessage()

  Getter for message property.

  Returns:
    custom message which should be used to report about violations.

### setIgnoreCase

    public void setIgnoreCase(boolean aCaseInsensitive)

  Set whether or not the match is case sensitive.

  Parameters:
    `aCaseInsensitive` - true if the match is case insensitive.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2001-2011. All Rights Reserved.