Class AbstractNameCheck
java.lang.Object
com.puppycrawl.tools.checkstyle.AbstractAutomaticBean
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, RecordComponentNameCheck, RecordTypeParameterNameCheck
Abstract class for checking that names conform to a specified format.
-
Nested Class Summary
Nested classes/interfaces inherited from class AbstractAutomaticBean
AbstractAutomaticBean.OutputStreamOptions -
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractNameCheck(String format) Creates a newAbstractNameCheckinstance. -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract booleanmustCheckName(DetailAST ast) Decides whether the name of an AST should be checked against the format regexp.final voidSets the pattern to match valid identifiers.voidvisitToken(DetailAST ast) Called to process a token.Methods inherited from class AbstractCheck
beginTree, clearViolations, destroy, finishTree, getAcceptableTokens, getDefaultTokens, getFileContents, getFilePath, getLine, getLineCodePoints, getLines, getRequiredTokens, getTabWidth, getTokenNames, getViolations, init, isCommentNodesRequired, leaveToken, log, log, log, setFileContents, setTabWidth, setTokensMethods inherited from class AbstractViolationReporter
finishLocalSetup, getCustomMessages, getId, getMessageBundle, getSeverity, getSeverityLevel, setId, setSeverityMethods inherited from class AbstractAutomaticBean
configure, contextualize, getConfiguration, setupChild
-
Field Details
-
MSG_INVALID_PATTERN
-
format
The regexp to match against.
-
-
Constructor Details
-
AbstractNameCheck
Creates a newAbstractNameCheckinstance.- 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
Sets the pattern to match valid identifiers.- Parameters:
pattern- the new pattern
-
visitToken
Description copied from class:AbstractCheckCalled to process a token.- Overrides:
visitTokenin classAbstractCheck- Parameters:
ast- the token to process
-