com.puppycrawl.tools.checkstyle.checks.regexp
Class RegexpSinglelineJavaCheck

java.lang.Object
  extended by com.puppycrawl.tools.checkstyle.api.AutomaticBean
      extended by com.puppycrawl.tools.checkstyle.api.AbstractViolationReporter
          extended by com.puppycrawl.tools.checkstyle.api.Check
              extended by com.puppycrawl.tools.checkstyle.checks.regexp.RegexpSinglelineJavaCheck
All Implemented Interfaces:
Configurable, Contextualizable

public class RegexpSinglelineJavaCheck
extends Check

Implementation of a check that looks for a single line in Java files. Supports ignoring comments for matches.

Author:
Oliver Burn

Constructor Summary
RegexpSinglelineJavaCheck()
           
 
Method Summary
 void beginTree(DetailAST aRootAST)
          Called before the starting to process a tree.
 int[] getDefaultTokens()
          Returns the default token a check is interested in.
 void init()
          Initialise the check.
 void setFormat(String aFormat)
          Set the format of the regular expression to match.
 void setIgnoreCase(boolean aIgnore)
          Set whether to ignore case when matching.
 void setIgnoreComments(boolean aIgnore)
          Set whether to ignore comments when matching.
 void setMaximum(int aMaximum)
          Set the maximum number of matches required per file.
 void setMessage(String aMessage)
          Set the message to report for a match.
 void setMinimum(int aMinimum)
          Set the minimum number of matches required per file.
 
Methods inherited from class com.puppycrawl.tools.checkstyle.api.Check
destroy, finishTree, getAcceptableTokens, getClassLoader, getFileContents, getLines, getRequiredTokens, getTabWidth, getTokenNames, leaveToken, log, log, setClassLoader, setFileContents, setMessages, setTabWidth, setTokens, visitToken
 
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

RegexpSinglelineJavaCheck

public RegexpSinglelineJavaCheck()
Method Detail

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

init

public void init()
Description copied from class: Check
Initialise the check. This is the time to verify that the check has everything required to perform it job.

Overrides:
init in class Check

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

setFormat

public void setFormat(String aFormat)
Set the format of the regular expression to match.

Parameters:
aFormat - the format of the regular expression to match.

setMessage

public void setMessage(String aMessage)
Set the message to report for a match.

Parameters:
aMessage - the message to report for a match.

setMinimum

public void setMinimum(int aMinimum)
Set the minimum number of matches required per file.

Parameters:
aMinimum - the minimum number of matches required per file.

setMaximum

public void setMaximum(int aMaximum)
Set the maximum number of matches required per file.

Parameters:
aMaximum - the maximum number of matches required per file.

setIgnoreCase

public void setIgnoreCase(boolean aIgnore)
Set whether to ignore case when matching.

Parameters:
aIgnore - whether to ignore case when matching.

setIgnoreComments

public void setIgnoreComments(boolean aIgnore)
Set whether to ignore comments when matching.

Parameters:
aIgnore - whether to ignore comments when matching.

Back to the Checkstyle Home Page