Class AbstractNameCheck
java.lang.Object
com.puppycrawl.tools.checkstyle.api.AutomaticBean
com.puppycrawl.tools.checkstyle.api.AbstractViolationReporter
com.puppycrawl.tools.checkstyle.api.AbstractCheck
com.puppycrawl.tools.checkstyle.checks.naming.AbstractNameCheck
- All Implemented Interfaces:
Configurable
,Contextualizable
- Direct Known Subclasses:
AbstractAccessControlNameCheck
,CatchParameterNameCheck
,ClassTypeParameterNameCheck
,IllegalIdentifierNameCheck
,InterfaceTypeParameterNameCheck
,LambdaParameterNameCheck
,LocalFinalVariableNameCheck
,LocalVariableNameCheck
,MethodTypeParameterNameCheck
,ParameterNameCheck
,PatternVariableNameCheck
,RecordTypeParameterNameCheck
Abstract class for checking that names conform to a specified format.
-
Nested Class Summary
Nested classes/interfaces inherited from class com.puppycrawl.tools.checkstyle.api.AutomaticBean
AutomaticBean.OutputStreamOptions
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
AbstractNameCheck
(String format) Creates a newAbstractNameCheck
instance. -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract boolean
mustCheckName
(DetailAST ast) Decides whether the name of an AST should be checked against the format regexp.final void
Set the format for the specified regular expression.void
visitToken
(DetailAST ast) Called to process a token.Methods inherited from class com.puppycrawl.tools.checkstyle.api.AbstractCheck
beginTree, clearMessages, destroy, finishTree, getAcceptableTokens, getDefaultTokens, getFileContents, getLine, getLines, getMessages, getRequiredTokens, getTabWidth, getTokenNames, init, isCommentNodesRequired, leaveToken, log, log, log, setFileContents, setTabWidth, setTokens
Methods inherited from class com.puppycrawl.tools.checkstyle.api.AbstractViolationReporter
finishLocalSetup, getCustomMessages, getId, getMessageBundle, getSeverity, getSeverityLevel, setId, setSeverity
Methods inherited from class com.puppycrawl.tools.checkstyle.api.AutomaticBean
configure, contextualize, getConfiguration, setupChild
-
Field Details
-
MSG_INVALID_PATTERN
Message key for invalid pattern violation.- See Also:
-
-
Constructor Details
-
AbstractNameCheck
Creates a newAbstractNameCheck
instance.- Parameters:
format
- format to check with
-
-
Method Details
-
mustCheckName
Decides whether the name of an AST should be checked against the format regexp.- Parameters:
ast
- the AST to check.- Returns:
- true if the IDENT subnode of ast should be checked against the format regexp.
-
setFormat
Set the format for the specified regular expression.- Parameters:
pattern
- the new pattern
-
visitToken
Description copied from class:AbstractCheck
Called to process a token.- Overrides:
visitToken
in classAbstractCheck
- Parameters:
ast
- the token to process
-