Class EnumValueNameCheck
- 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
-
- com.github.sevntu.checkstyle.checks.naming.EnumValueNameCheck
-
- All Implemented Interfaces:
com.puppycrawl.tools.checkstyle.api.Configurable
,com.puppycrawl.tools.checkstyle.api.Contextualizable
public class EnumValueNameCheck extends com.puppycrawl.tools.checkstyle.checks.naming.AbstractNameCheck
Checks that enumeration value names conform to a format specified by the format property. The format is a
regular expression
and defaults to ^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$.An example of how to configure the check is:
<module name="EnumValueName"/>
An example of how to configure the check for names that requires all names to be lowercase with underscores and digits is:
<module name="EnumValueName"> <property name="format" value="^[a-z_0-9]+*$"/> </module>
- Since:
- 1.24.0
- Author:
- Pavel Baranchikov
-
-
Field Summary
Fields Modifier and Type Field Description static String
DEFAULT_PATTERN
Default pattern for Values Enumeration names.
-
Constructor Summary
Constructors Constructor Description EnumValueNameCheck()
Creates a newEnumValueNameCheck
instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int[]
getAcceptableTokens()
int[]
getDefaultTokens()
int[]
getRequiredTokens()
protected boolean
mustCheckName(com.puppycrawl.tools.checkstyle.api.DetailAST ast)
-
Methods inherited from class com.puppycrawl.tools.checkstyle.checks.naming.AbstractNameCheck
setFormat, visitToken
-
Methods inherited from class com.puppycrawl.tools.checkstyle.api.AbstractCheck
beginTree, clearViolations, destroy, finishTree, getFileContents, getFilePath, getLine, getLineCodePoints, getLines, getTabWidth, getTokenNames, getViolations, 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
-
-
-
-
Field Detail
-
DEFAULT_PATTERN
public static final String DEFAULT_PATTERN
Default pattern for Values Enumeration names.- See Also:
- Constant Field Values
-
-
Method Detail
-
getDefaultTokens
public int[] getDefaultTokens()
- Specified by:
getDefaultTokens
in classcom.puppycrawl.tools.checkstyle.api.AbstractCheck
-
getAcceptableTokens
public int[] getAcceptableTokens()
- Specified by:
getAcceptableTokens
in classcom.puppycrawl.tools.checkstyle.api.AbstractCheck
-
getRequiredTokens
public int[] getRequiredTokens()
- Specified by:
getRequiredTokens
in classcom.puppycrawl.tools.checkstyle.api.AbstractCheck
-
mustCheckName
protected boolean mustCheckName(com.puppycrawl.tools.checkstyle.api.DetailAST ast)
- Specified by:
mustCheckName
in classcom.puppycrawl.tools.checkstyle.checks.naming.AbstractNameCheck
-
-