com.puppycrawl.tools.checkstyle.checks.coding

Class MultipleStringLiteralsCheck

Implemented Interfaces:
Configurable, Contextualizable

public class MultipleStringLiteralsCheck
extends Check

Checks for multiple occurrences of the same string literal within a single file.
Author:
Daniel Grenner

Constructor Summary

MultipleStringLiteralsCheck()
Construct an instance with default values.

Method Summary

void
beginTree(DetailAST aRootAST)
void
finishTree(DetailAST aRootAST)
int[]
getDefaultTokens()
void
setAllowedDuplicates(int aAllowedDuplicates)
Sets the maximum allowed duplicates of a string.
void
setIgnoreStringsRegexp(String aIgnoreStringsRegexp)
Sets regexp pattern for ignored strings.
void
visitToken(DetailAST aAST)

Methods inherited from class com.puppycrawl.tools.checkstyle.api.Check

beginTree, destroy, finishTree, getAcceptableTokens, getClassLoader, getDefaultTokens, getFileContents, getLines, getRequiredTokens, getTabWidth, getTokenNames, init, leaveToken, log, log, setClassLoader, setFileContents, setMessages, setTabWidth, setTokens, visitToken

Methods inherited from class com.puppycrawl.tools.checkstyle.api.AbstractViolationReporter

getId, getMessageBundle, getSeverity, getSeverityLevel, log, log, log, log, log, log, log, log, log, log, log, setId, setSeverity

Methods inherited from class com.puppycrawl.tools.checkstyle.api.AutomaticBean

configure, contextualize, finishLocalSetup, getConfiguration, setupChild

Constructor Details

MultipleStringLiteralsCheck

public MultipleStringLiteralsCheck()
Construct an instance with default values.

Method Details

beginTree

public void beginTree(DetailAST aRootAST)
Overrides:
beginTree in interface Check

finishTree

public void finishTree(DetailAST aRootAST)
Overrides:
finishTree in interface Check

getDefaultTokens

public int[] getDefaultTokens()
Overrides:
getDefaultTokens in interface Check

setAllowedDuplicates

public void setAllowedDuplicates(int aAllowedDuplicates)
Sets the maximum allowed duplicates of a string.
Parameters:
aAllowedDuplicates - The maximum number of duplicates.

setIgnoreStringsRegexp

public void setIgnoreStringsRegexp(String aIgnoreStringsRegexp)
Sets regexp pattern for ignored strings.
Parameters:
aIgnoreStringsRegexp - regexp pattern for ignored strings

visitToken

public void visitToken(DetailAST aAST)
Overrides:
visitToken in interface Check