public class RecordTypeParameterNameCheck extends AbstractNameCheck
Checks that record type parameter names conform to a specified pattern.
format - Specifies valid identifiers.
Type is java.util.regex.Pattern.
Default value is "^[A-Z]$".
To configure the check:
<module name="RecordTypeParameterName"/>
An example of how to configure the check for names that are only a single letter is:
Configuration:
<module name="RecordTypeParameterName"> <property name="format" value="^[a-zA-Z]$"/> </module>
Example:
record MyRecord1<T> {} // OK
record MyRecord2<t> {} // OK
record MyRecord3<abc> {} // violation, the record type parameter
// name should match the regular expression "^[a-zA-Z]$"
Parent is com.puppycrawl.tools.checkstyle.TreeWalker
Violation Message Keys:
name.invalidPattern
AutomaticBean.OutputStreamOptionsMSG_INVALID_PATTERN| Constructor and Description |
|---|
RecordTypeParameterNameCheck()
Creates a new
RecordTypeParameterNameCheck instance. |
| Modifier and Type | Method and Description |
|---|---|
int[] |
getAcceptableTokens()
The configurable token set.
|
int[] |
getDefaultTokens()
Returns the default token a check is interested in.
|
int[] |
getRequiredTokens()
The tokens that this check must be registered for.
|
protected boolean |
mustCheckName(DetailAST ast)
Decides whether the name of an AST should be checked against
the format regexp.
|
setFormat, visitTokenbeginTree, clearMessages, destroy, finishTree, getFileContents, getLine, getLines, getMessages, getTabWidth, getTokenNames, init, isCommentNodesRequired, leaveToken, log, log, log, setFileContents, setTabWidth, setTokensfinishLocalSetup, getCustomMessages, getId, getMessageBundle, getSeverity, getSeverityLevel, setId, setSeverityconfigure, contextualize, getConfiguration, setupChildpublic RecordTypeParameterNameCheck()
RecordTypeParameterNameCheck instance.public int[] getDefaultTokens()
AbstractCheckgetDefaultTokens in class AbstractCheckTokenTypespublic final int[] getAcceptableTokens()
AbstractCheckgetAcceptableTokens in class AbstractCheckTokenTypespublic int[] getRequiredTokens()
AbstractCheckgetRequiredTokens in class AbstractCheckTokenTypesprotected final boolean mustCheckName(DetailAST ast)
AbstractNameCheckmustCheckName in class AbstractNameCheckast - the AST to check.Copyright © 2001-2020. All Rights Reserved.