blob: e6a3683b5a824feb5930531d67edc2f431d17be7 [file] [log] [blame]
<?xml version="1.0" encoding="UTF-8"?>
<document xmlns="http://maven.apache.org/XDOC/2.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/XDOC/2.0 http://maven.apache.org/xsd/xdoc-2.0.xsd">
<head>
<title>Naming Conventions</title>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"/>
<script type="text/javascript" src="js/anchors.js"/>
<script type="text/javascript" src="js/google-analytics.js"/>
<link rel="icon" href="images/favicon.png" type="image/x-icon" />
<link rel="shortcut icon" href="images/favicon.ico" type="image/ico" />
</head>
<body>
<section name="Content">
<macro name="toc">
<param name="fromDepth" value="1"/>
<param name="toDepth" value="1"/>
</macro>
</section>
<section name="Overview">
<p>
Each of these naming modules validates identifiers for particular code
elements. Valid identifiers for a naming module are specified by its
<code> format</code> property. The value of <code>format</code> is a <a
href="https://docs.oracle.com/javase/1.5.0/docs/api/java/util/regex/Pattern.html">
regular expression</a> for valid identifiers.
</p>
</section>
<section name="AbbreviationAsWordInName">
<subsection name="Description">
<p>Since Checkstyle 5.8</p>
<p>
The Check validate abbreviations(consecutive capital letters)
length in identifier name, it also allows to enforce camel case naming. Please read more at
<a href="http://checkstyle.sourceforge.net/reports/google-java-style-20170228.html#s5.3-camel-case">
Google Style Guide</a>
to get to know how to avoid long abbreviations in names.
</p>
<p>
<i>allowedAbbreviationLength</i> specifies how many consecutive capital letters are
allowed in the identifier.
A value of <i>3</i> indicates that up to 4 consecutive capital letters are allowed,
one after the other, before a violation is printed. The identifier 'MyTEST' would be
allowed, but 'MyTESTS' would not be.
A value of <i>0</i> indicates that only 1 consecutive capital letter is allowed. This
is what should be used to enforce strict camel casing. The identifier 'MyTest' would
be allowed, but 'MyTEst' would not be.
</p>
</subsection>
<subsection name="Properties">
<table>
<tr>
<th>name</th>
<th>description</th>
<th>type</th>
<th>default value</th>
<th>since</th>
</tr>
<tr>
<td>allowedAbbreviationLength</td>
<td>indicates on the number of consecutive capital letters allowed in targeted identifiers
(abbreviations in the classes, interfaces, variables and methods names, ... ).</td>
<td><a href="property_types.html#integer">Integer</a></td>
<td>3</td>
<td>5.8</td>
</tr>
<tr>
<td>allowedAbbreviations</td>
<td>list of abbreviations that must be skipped for checking.
Abbreviations should be separated by comma, no spaces are allowed.</td>
<td><a href="property_types.html#stringSet">String Set</a></td>
<td>null</td>
<td>5.8</td>
</tr>
<tr>
<td>ignoreFinal</td>
<td>allow to skip variables with final modifier.</td>
<td><a href="property_types.html#boolean">Boolean</a></td>
<td>true</td>
<td>5.8</td>
</tr>
<tr>
<td>ignoreStatic</td>
<td>allow to skip variables with static modifier.</td>
<td><a href="property_types.html#boolean">Boolean</a></td>
<td>true</td>
<td>5.8</td>
</tr>
<tr>
<td>ignoreOverriddenMethods</td>
<td>Allows to ignore methods tagged with @Override annotation
(that usually mean inherited name).</td>
<td><a href="property_types.html#boolean">Boolean</a></td>
<td>true</td>
<td>5.8</td>
</tr>
<tr>
<td>tokens</td>
<td>tokens to check</td>
<td>
subset of tokens
<a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#CLASS_DEF">CLASS_DEF</a>,
<a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#INTERFACE_DEF">INTERFACE_DEF</a>,
<a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#ENUM_DEF">ENUM_DEF</a>,
<a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#ANNOTATION_DEF">ANNOTATION_DEF</a>,
<a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#ANNOTATION_FIELD_DEF">ANNOTATION_FIELD_DEF</a>,
<a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#PARAMETER_DEF">PARAMETER_DEF</a>,
<a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#VARIABLE_DEF">VARIABLE_DEF</a>,
<a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#METHOD_DEF">METHOD_DEF</a>,
<a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#ENUM_CONSTANT_DEF">ENUM_CONSTANT_DEF</a>.
</td>
<td>
<a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#CLASS_DEF">CLASS_DEF</a>,
<a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#INTERFACE_DEF">INTERFACE_DEF</a>,
<a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#ENUM_DEF">ENUM_DEF</a>,
<a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#ANNOTATION_DEF">ANNOTATION_DEF</a>,
<a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#ANNOTATION_FIELD_DEF">ANNOTATION_FIELD_DEF</a>,
<a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#PARAMETER_DEF">PARAMETER_DEF</a>,
<a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#VARIABLE_DEF">VARIABLE_DEF</a>,
<a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#METHOD_DEF">METHOD_DEF</a>.
</td>
<td>5.8</td>
</tr>
</table>
</subsection>
<subsection name="Examples">
<p>
Default configuration
<source>
&lt;module name="AbbreviationAsWordInName"/&gt;
</source>
</p>
<p>
To configure to check variables and classes identifiers,
do not ignore variables with static modifier and allow
no abbreviations (enforce camel case phrase) and
allow no abbreviations to use (camel case phrase) and allow XML and URL abbreviations.
</p>
<source>
&lt;module name="AbbreviationAsWordInName"&gt;
&lt;property name="tokens" value="VARIABLE_DEF,CLASS_DEF"/&gt;
&lt;property name="ignoreStatic" value="false"/&gt;
&lt;property name="allowedAbbreviationLength" value="1"/&gt;
&lt;property name="allowedAbbreviations" value="XML,URL"/&gt;
&lt;/module&gt;
</source>
</subsection>
<subsection name="Example of Usage">
<ul>
<li>
<a href="https://github.com/search?q=path%3Asrc%2Fmain%2Fresources+filename%3Agoogle_checks.xml+repo%3Acheckstyle%2Fcheckstyle+AbbreviationAsWordInName">
Google Style</a>
</li>
<li>
<a href="https://github.com/search?q=path%3Aconfig+filename%3Acheckstyle_checks.xml+repo%3Acheckstyle%2Fcheckstyle+AbbreviationAsWordInName">
Checkstyle Style</a>
</li>
</ul>
</subsection>
<subsection name="Error Messages">
<ul>
<li>
<a href="https://github.com/search?q=path%3Asrc%2Fmain%2Fresources%2Fcom%2Fpuppycrawl%2Ftools%2Fcheckstyle%2Fchecks%2Fnaming+filename%3Amessages*.properties+repo%3Acheckstyle%2Fcheckstyle+%22abbreviation.as.word%22">
abbreviation.as.word</a>
</li>
</ul>
<p>
All messages can be customized if the default message doesn't suit you.
Please <a href="config.html#Custom_messages">see the documentation</a> to learn how to.
</p>
</subsection>
<subsection name="Package">
<p> com.puppycrawl.tools.checkstyle.checks.naming </p>
</subsection>
<subsection name="Parent Module">
<p> <a href="config.html#TreeWalker">TreeWalker</a> </p>
</subsection>
</section>
<section name="AbstractClassName">
<subsection name="Description">
<p>Since Checkstyle 3.2</p>
<p>Validates identifiers for <code>abstract</code> classes.</p>
</subsection>
<subsection name="Properties">
<table>
<tr>
<th>name</th>
<th>description</th>
<th>type</th>
<th>default value</th>
<th>since</th>
</tr>
<tr>
<td>format</td>
<td>Specifies valid identifiers.</td>
<td><a href="property_types.html#regexp">Regular Expression</a></td>
<td><code>"^Abstract.+$"</code></td>
<td>3.2</td>
</tr>
<tr>
<td>ignoreModifier</td>
<td>
Controls whether to ignore checking for the
<code>abstract</code> modifier on classes that match the
name.
</td>
<td><a href="property_types.html#boolean">Boolean</a></td>
<td><code>false</code></td>
<td>5.3</td>
</tr>
<tr>
<td>ignoreName</td>
<td>
Controls whether to ignore checking the name. Realistically
only useful if using the check to identify that match name
and do not have the <code>abstract</code> modifier. name.
</td>
<td><a href="property_types.html#boolean">Boolean</a></td>
<td><code>false</code></td>
<td>5.3</td>
</tr>
</table>
</subsection>
<subsection name="Examples">
<p>
The following example shows how to configure the
<code>AbstractClassName</code> to checks names, but ignore
missing <code>abstract</code> modifiers:
</p>
<source>
&lt;module name=&quot;AbstractClassName&quot;&gt;
&lt;property name=&quot;ignoreModifier&quot; value=&quot;true&quot;/&gt;
&lt;/module&gt;
</source>
</subsection>
<subsection name="Example of Usage">
<ul>
<li>
<a href="https://github.com/search?q=path%3Aconfig+filename%3Acheckstyle_checks.xml+repo%3Acheckstyle%2Fcheckstyle+AbstractClassName">
Checkstyle Style</a>
</li>
</ul>
</subsection>
<subsection name="Error Messages">
<ul>
<li>
<a href="https://github.com/search?q=path%3Asrc%2Fmain%2Fresources%2Fcom%2Fpuppycrawl%2Ftools%2Fcheckstyle%2Fchecks%2Fnaming+filename%3Amessages*.properties+repo%3Acheckstyle%2Fcheckstyle+%22illegal.abstract.class.name%22">
illegal.abstract.class.name</a>
</li>
<li>
<a href="https://github.com/search?q=path%3Asrc%2Fmain%2Fresources%2Fcom%2Fpuppycrawl%2Ftools%2Fcheckstyle%2Fchecks%2Fnaming+filename%3Amessages*.properties+repo%3Acheckstyle%2Fcheckstyle+%22no.abstract.class.modifier%22">
no.abstract.class.modifier</a>
</li>
</ul>
<p>
All messages can be customized if the default message doesn't suit you.
Please <a href="config.html#Custom_messages">see the documentation</a> to learn how to.
</p>
</subsection>
<subsection name="Package">
<p> com.puppycrawl.tools.checkstyle.checks.naming </p>
</subsection>
<subsection name="Parent Module">
<p> <a href="config.html#TreeWalker">TreeWalker</a> </p>
</subsection>
</section>
<section name="CatchParameterName">
<subsection name="Description">
<p>Since Checkstyle 6.14</p>
<p>
Checks that catch parameter names conform to a format specified by the format property.
Default pattern has the following characteristic:
</p>
<ul>
<li>allows names beginning with two lowercase letters followed by at least one uppercase
or lowercase letter</li>
<li>allows <code>e</code> abbreviation (suitable for exceptions end errors)</li>
<li>allows <code>ex</code> abbreviation (suitable for exceptions)</li>
<li>allows <code>t</code> abbreviation (suitable for throwables)</li>
<li>prohibits numbered abbreviations like <code>e1</code> or <code>t2</code></li>
<li>prohibits one letter prefixes like <code>pException</code></li>
<li>prohibits two letter abbreviations like <code>ie</code> or <code>ee</code></li>
<li>prohibits any other characters than letters</li>
</ul>
</subsection>
<subsection name="Properties">
<table>
<tr>
<th>name</th>
<th>description</th>
<th>type</th>
<th>default value</th>
<th>since</th>
</tr>
<tr>
<td>format</td>
<td>Specifies valid identifiers.</td>
<td>
<a href="property_types.html#regexp">Regular Expression</a>
</td>
<td>
<code>"^(e|t|ex|[a-z][a-z][a-zA-Z]+)$"</code>
</td>
<td>6.14</td>
</tr>
</table>
</subsection>
<subsection name="Examples">
<p>
To configure the check:
</p>
<source>
&lt;module name=&quot;CatchParameterName&quot;/&gt;
</source>
<p>
An example of how to configure the check for names that begin with
a lower case letter, followed by letters and digits is:
</p>
<source>
&lt;module name="CatchParameterName"&gt;
&lt;property name="format" value="^[a-z][a-zA-Z0-9]+$"/&gt;
&lt;/module&gt;
</source>
</subsection>
<subsection name="Example of Usage">
<ul>
<li>
<a href="https://github.com/search?q=path%3Asrc%2Fmain%2Fresources+filename%3Agoogle_checks.xml+repo%3Acheckstyle%2Fcheckstyle+CatchParameterName">
Google Style
</a>
</li>
<li>
<a href="https://github.com/search?q=path%3Aconfig+filename%3Acheckstyle_checks.xml+repo%3Acheckstyle%2Fcheckstyle+CatchParameterName">
Checkstyle Style
</a>
</li>
</ul>
</subsection>
<subsection name="Error Messages">
<ul>
<li>
<a href="https://github.com/search?q=path%3Asrc%2Fmain%2Fresources%2Fcom%2Fpuppycrawl%2Ftools%2Fcheckstyle%2Fchecks%2Fnaming+filename%3Amessages*.properties+repo%3Acheckstyle%2Fcheckstyle+%22name.invalidPattern%22">
name.invalidPattern</a>
</li>
</ul>
<p>
All messages can be customized if the default message doesn't suit you.
Please <a href="config.html#Custom_messages">see the documentation</a> to learn how to.
</p>
</subsection>
<subsection name="Package">
<p>com.puppycrawl.tools.checkstyle.checks.naming</p>
</subsection>
<subsection name="Parent Module">
<p>
<a href="config.html#TreeWalker">TreeWalker</a>
</p>
</subsection>
</section>
<section name="ClassTypeParameterName">
<subsection name="Description">
<p>Since Checkstyle 5.0</p>
<p>Validates identifiers for class type parameters.</p>
</subsection>
<subsection name="Properties">
<table>
<tr>
<th>name</th>
<th>description</th>
<th>type</th>
<th>default value</th>
<th>since</th>
</tr>
<tr>
<td>format</td>
<td>Specifies valid identifiers.</td>
<td><a href="property_types.html#regexp">Regular Expression</a></td>
<td><code>"^[A-Z]$"</code></td>
<td>5.0</td>
</tr>
</table>
</subsection>
<subsection name="Examples">
<p>
To configure the check:
</p>
<source>
&lt;module name=&quot;ClassTypeParameterName&quot;/&gt;
</source>
</subsection>
<subsection name="Example of Usage">
<ul>
<li>
<a href="https://github.com/search?q=path%3Asrc%2Fmain%2Fresources+filename%3Agoogle_checks.xml+repo%3Acheckstyle%2Fcheckstyle+ClassTypeParameterName">
Google Style</a>
</li>
<li>
<a href="https://github.com/search?q=path%3Aconfig+filename%3Acheckstyle_checks.xml+repo%3Acheckstyle%2Fcheckstyle+ClassTypeParameterName">
Checkstyle Style</a>
</li>
</ul>
</subsection>
<subsection name="Error Messages">
<ul>
<li>
<a href="https://github.com/search?q=path%3Asrc%2Fmain%2Fresources%2Fcom%2Fpuppycrawl%2Ftools%2Fcheckstyle%2Fchecks%2Fnaming+filename%3Amessages*.properties+repo%3Acheckstyle%2Fcheckstyle+%22name.invalidPattern%22">
name.invalidPattern</a>
</li>
</ul>
<p>
All messages can be customized if the default message doesn't suit you.
Please <a href="config.html#Custom_messages">see the documentation</a> to learn how to.
</p>
</subsection>
<subsection name="Package">
<p> com.puppycrawl.tools.checkstyle.checks.naming </p>
</subsection>
<subsection name="Parent Module">
<p> <a href="config.html#TreeWalker">TreeWalker</a> </p>
</subsection>
</section>
<section name="ConstantName">
<subsection name="Description">
<p>Since Checkstyle 3.0</p>
<p>
Validates identifiers for constants (<code>static</code>, <code>
final</code> fields).
</p>
</subsection>
<subsection name="Properties">
<table>
<tr>
<th>name</th>
<th>description</th>
<th>type</th>
<th>default value</th>
<th>since</th>
</tr>
<tr>
<td>format</td>
<td>Specifies valid identifiers.</td>
<td><a href="property_types.html#regexp">Regular Expression</a></td>
<td><code>"^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$"</code></td>
<td>3.0</td>
</tr>
<tr>
<td>applyToPublic</td>
<td>Controls whether to apply the check to public member.</td>
<td><a href="property_types.html#boolean">Boolean</a></td>
<td><code>true</code></td>
<td>5.0</td>
</tr>
<tr>
<td>applyToProtected</td>
<td>Controls whether to apply the check to protected member.</td>
<td><a href="property_types.html#boolean">Boolean</a></td>
<td><code>true</code></td>
<td>5.0</td>
</tr>
<tr>
<td>applyToPackage</td>
<td>
Controls whether to apply the check to package-private member.
</td>
<td><a href="property_types.html#boolean">Boolean</a></td>
<td><code>true</code></td>
<td>5.0</td>
</tr>
<tr>
<td>applyToPrivate</td>
<td>Controls whether to apply the check to private member.</td>
<td><a href="property_types.html#boolean">Boolean</a></td>
<td><code>true</code></td>
<td>5.0</td>
</tr>
</table>
</subsection>
<subsection name="Examples">
<p>
Property <code>format</code> in module <code>ConstantName</code>
is used to specify names to be allowed. The following configuration
apart from names allowed by default allows <code>log</code> or
<code>logger</code>:
</p>
<source>
&lt;module name=&quot;ConstantName&quot;&gt;
&lt;property name=&quot;format&quot;
value=&quot;^log(ger)?|[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$&quot;/&gt;
&lt;/module&gt;
</source>
</subsection>
<subsection name="Example of Usage">
<ul>
<li>
<a href="https://github.com/search?q=path%3Asrc%2Fmain%2Fresources+filename%3Asun_checks.xml+repo%3Acheckstyle%2Fcheckstyle+ConstantName">
Sun Style</a>
</li>
<li>
<a href="https://github.com/search?q=path%3Aconfig+filename%3Acheckstyle_checks.xml+repo%3Acheckstyle%2Fcheckstyle+ConstantName">
Checkstyle Style</a>
</li>
</ul>
</subsection>
<subsection name="Error Messages">
<ul>
<li>
<a href="https://github.com/search?q=path%3Asrc%2Fmain%2Fresources%2Fcom%2Fpuppycrawl%2Ftools%2Fcheckstyle%2Fchecks%2Fnaming+filename%3Amessages*.properties+repo%3Acheckstyle%2Fcheckstyle+%22name.invalidPattern%22">
name.invalidPattern</a>
</li>
</ul>
<p>
All messages can be customized if the default message doesn't suit you.
Please <a href="config.html#Custom_messages">see the documentation</a> to learn how to.
</p>
</subsection>
<subsection name="Package">
<p> com.puppycrawl.tools.checkstyle.checks.naming </p>
</subsection>
<subsection name="Parent Module">
<p> <a href="config.html#TreeWalker">TreeWalker</a> </p>
</subsection>
</section>
<section name="InterfaceTypeParameterName">
<subsection name="Description">
<p>Since Checkstyle 5.8</p>
<p>
Validates identifiers for interface type parameters.
</p>
</subsection>
<subsection name="Properties">
<table>
<tr>
<th>name</th>
<th>description</th>
<th>type</th>
<th>default value</th>
<th>since</th>
</tr>
<tr>
<td>format</td>
<td>Specifies valid identifiers.</td>
<td><a href="property_types.html#regexp">Regular Expression</a></td>
<td><code>"^[A-Z]$"</code></td>
<td>5.8</td>
</tr>
</table>
</subsection>
<subsection name="Examples">
<p>
To configure the check:
</p>
<source>
&lt;module name=&quot;InterfaceTypeParameterName&quot;/&gt;
</source>
</subsection>
<subsection name="Example of Usage">
<ul>
<li>
<a href="https://github.com/search?q=path%3Asrc%2Fmain%2Fresources+filename%3Agoogle_checks.xml+repo%3Acheckstyle%2Fcheckstyle+InterfaceTypeParameterName">
Google Style</a>
</li>
<li>
<a href="https://github.com/search?q=path%3Aconfig+filename%3Acheckstyle_checks.xml+repo%3Acheckstyle%2Fcheckstyle+InterfaceTypeParameterName">
Checkstyle Style</a>
</li>
</ul>
</subsection>
<subsection name="Error Messages">
<ul>
<li>
<a href="https://github.com/search?q=path%3Asrc%2Fmain%2Fresources%2Fcom%2Fpuppycrawl%2Ftools%2Fcheckstyle%2Fchecks%2Fnaming+filename%3Amessages*.properties+repo%3Acheckstyle%2Fcheckstyle+%22name.invalidPattern%22">
name.invalidPattern</a>
</li>
</ul>
<p>
All messages can be customized if the default message doesn't suit you.
Please <a href="config.html#Custom_messages">see the documentation</a> to learn how to.
</p>
</subsection>
<subsection name="Package">
<p> com.puppycrawl.tools.checkstyle.checks.naming </p>
</subsection>
<subsection name="Parent Module">
<p> <a href="config.html#TreeWalker">TreeWalker</a> </p>
</subsection>
</section>
<section name="LocalFinalVariableName">
<subsection name="Description">
<p>Since Checkstyle 3.0</p>
<p>
Validates identifiers for local, <code>final</code> variables, including
<code>catch</code> parameters and resources in <code>try</code> statements.
</p>
</subsection>
<subsection name="Properties">
<table>
<tr>
<th>name</th>
<th>description</th>
<th>type</th>
<th>default value</th>
<th>since</th>
</tr>
<tr>
<td>format</td>
<td>Specifies valid identifiers.</td>
<td><a href="property_types.html#regexp">Regular Expression</a></td>
<td><code>"^[a-z][a-zA-Z0-9]*$"</code></td>
<td>3.0</td>
</tr>
<tr>
<td>tokens</td>
<td>tokens to check</td>
<td>
subset of tokens
<a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#VARIABLE_DEF">VARIABLE_DEF</a>,
<a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#PARAMETER_DEF">PARAMETER_DEF</a>,
<a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#RESOURCE">RESOURCE</a>.
</td>
<td>
<a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#VARIABLE_DEF">VARIABLE_DEF</a>,
<a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#PARAMETER_DEF">PARAMETER_DEF</a>,
<a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#RESOURCE">RESOURCE</a>.
</td>
<td>3.0</td>
</tr>
</table>
</subsection>
<subsection name="Examples">
<p>
To configure the check:
</p>
<source>
&lt;module name=&quot;LocalFinalVariableName&quot;/&gt;
</source>
</subsection>
<subsection name="Example of Usage">
<ul>
<li>
<a href="https://github.com/search?q=path%3Asrc%2Fmain%2Fresources+filename%3Asun_checks.xml+repo%3Acheckstyle%2Fcheckstyle+LocalFinalVariableName">
Sun Style</a>
</li>
<li>
<a href="https://github.com/search?q=path%3Aconfig+filename%3Acheckstyle_checks.xml+repo%3Acheckstyle%2Fcheckstyle+LocalFinalVariableName">
Checkstyle Style</a>
</li>
</ul>
</subsection>
<subsection name="Error Messages">
<ul>
<li>
<a href="https://github.com/search?q=path%3Asrc%2Fmain%2Fresources%2Fcom%2Fpuppycrawl%2Ftools%2Fcheckstyle%2Fchecks%2Fnaming+filename%3Amessages*.properties+repo%3Acheckstyle%2Fcheckstyle+%22name.invalidPattern%22">
name.invalidPattern</a>
</li>
</ul>
<p>
All messages can be customized if the default message doesn't suit you.
Please <a href="config.html#Custom_messages">see the documentation</a> to learn how to.
</p>
</subsection>
<subsection name="Package">
<p> com.puppycrawl.tools.checkstyle.checks.naming </p>
</subsection>
<subsection name="Parent Module">
<p> <a href="config.html#TreeWalker">TreeWalker</a> </p>
</subsection>
</section>
<section name="LocalVariableName">
<subsection name="Description">
<p>Since Checkstyle 3.0</p>
<p>
Checks that local, non-<code>final</code> variable names conform to a format specified
by the format property.
</p>
</subsection>
<subsection name="Properties">
<table>
<tr>
<th>name</th>
<th>description</th>
<th>type</th>
<th>default value</th>
<th>since</th>
</tr>
<tr>
<td>format</td>
<td>Specifies valid identifiers.</td>
<td><a href="property_types.html#regexp">Regular Expression</a></td>
<td><code>"^[a-z][a-zA-Z0-9]*$"</code></td>
<td>3.0</td>
</tr>
<tr>
<td>allowOneCharVarInForLoop</td>
<td>
Allow one character variable name in <a href="https://docs.oracle.com/javase/tutorial/java/nutsandbolts/for.html"> initialization expressions</a> in FOR loop. For example:
<pre>
for (int i = 1; i &lt; 10; i++) {}
</pre>
</td>
<td><a href="property_types.html#boolean">Boolean</a></td>
<td><code>false</code></td>
<td>5.8</td>
</tr>
</table>
</subsection>
<subsection name="Examples">
<p>
To configure the check to use the default configuration:
</p>
<source>
&lt;module name=&quot;LocalVariableName&quot;/&gt;
</source>
<p>
An example of how to configure the check to allow one character variable name in
<a href="https://docs.oracle.com/javase/tutorial/java/nutsandbolts/for.html">
initialization expressions</a> in FOR loop:
</p>
<source>
&lt;module name="LocalVariableName"&gt;
&lt;property name="allowOneCharVarInForLoop" value="true"/&gt;
&lt;/module&gt;
</source>
</subsection>
<subsection name="Example of Usage">
<ul>
<li>
<a href="https://github.com/search?q=path%3Asrc%2Fmain%2Fresources+filename%3Agoogle_checks.xml+repo%3Acheckstyle%2Fcheckstyle+LocalVariableName">
Google Style</a>
</li>
<li>
<a href="https://github.com/search?q=path%3Asrc%2Fmain%2Fresources+filename%3Asun_checks.xml+repo%3Acheckstyle%2Fcheckstyle+LocalVariableName">
Sun Style</a>
</li>
<li>
<a href="https://github.com/search?q=path%3Aconfig+filename%3Acheckstyle_checks.xml+repo%3Acheckstyle%2Fcheckstyle+LocalVariableName">
Checkstyle Style</a>
</li>
</ul>
</subsection>
<subsection name="Error Messages">
<ul>
<li>
<a href="https://github.com/search?q=path%3Asrc%2Fmain%2Fresources%2Fcom%2Fpuppycrawl%2Ftools%2Fcheckstyle%2Fchecks%2Fnaming+filename%3Amessages*.properties+repo%3Acheckstyle%2Fcheckstyle+%22name.invalidPattern%22">
name.invalidPattern</a>
</li>
</ul>
<p>
All messages can be customized if the default message doesn't suit you.
Please <a href="config.html#Custom_messages">see the documentation</a> to learn how to.
</p>
</subsection>
<subsection name="Package">
<p> com.puppycrawl.tools.checkstyle.checks.naming </p>
</subsection>
<subsection name="Parent Module">
<p> <a href="config.html#TreeWalker">TreeWalker</a> </p>
</subsection>
</section>
<section name="MemberName">
<subsection name="Description">
<p>Since Checkstyle 3.0</p>
<p>
Validates identifiers for non-<code>static</code> fields.
</p>
</subsection>
<subsection name="Properties">
<table>
<tr>
<th>name</th>
<th>description</th>
<th>type</th>
<th>default value</th>
<th>since</th>
</tr>
<tr>
<td>format</td>
<td>Specifies valid identifiers.</td>
<td><a href="property_types.html#regexp">Regular Expression</a></td>
<td><code>"^[a-z][a-zA-Z0-9]*$"</code></td>
<td>3.0</td>
</tr>
<tr>
<td>applyToPublic</td>
<td>Controls whether to apply the check to public member.</td>
<td><a href="property_types.html#boolean">Boolean</a></td>
<td><code>true</code></td>
<td>3.4</td>
</tr>
<tr>
<td>applyToProtected</td>
<td>Controls whether to apply the check to protected member.</td>
<td><a href="property_types.html#boolean">Boolean</a></td>
<td><code>true</code></td>
<td>3.4</td>
</tr>
<tr>
<td>applyToPackage</td>
<td>
Controls whether to apply the check to package-private member.
</td>
<td><a href="property_types.html#boolean">Boolean</a></td>
<td><code>true</code></td>
<td>3.4</td>
</tr>
<tr>
<td>applyToPrivate</td>
<td>Controls whether to apply the check to private member.</td>
<td><a href="property_types.html#boolean">Boolean</a></td>
<td><code>true</code></td>
<td>3.4</td>
</tr>
</table>
</subsection>
<subsection name="Examples">
<p>
This is an example of a
configuration of the <code>MemberName</code> module to
ensure that member identifiers begin with
<code>&#39;m&#39;</code>, followed
by an upper case letter, and then letters and digits:
</p>
<source>
&lt;module name=&quot;MemberName&quot;&gt;
&lt;property name=&quot;format&quot; value=&quot;^m[A-Z][a-zA-Z0-9]*$&quot;/&gt;
&lt;/module&gt;
</source>
</subsection>
<subsection name="Example of Usage">
<ul>
<li>
<a href="https://github.com/search?q=path%3Asrc%2Fmain%2Fresources+filename%3Agoogle_checks.xml+repo%3Acheckstyle%2Fcheckstyle+MemberName">
Google Style</a>
</li>
<li>
<a href="https://github.com/search?q=path%3Asrc%2Fmain%2Fresources+filename%3Asun_checks.xml+repo%3Acheckstyle%2Fcheckstyle+MemberName">
Sun Style</a>
</li>
<li>
<a href="https://github.com/search?q=path%3Aconfig+filename%3Acheckstyle_checks.xml+repo%3Acheckstyle%2Fcheckstyle+MemberName">
Checkstyle Style</a>
</li>
</ul>
</subsection>
<subsection name="Error Messages">
<ul>
<li>
<a href="https://github.com/search?q=path%3Asrc%2Fmain%2Fresources%2Fcom%2Fpuppycrawl%2Ftools%2Fcheckstyle%2Fchecks%2Fnaming+filename%3Amessages*.properties+repo%3Acheckstyle%2Fcheckstyle+%22name.invalidPattern%22">
name.invalidPattern</a>
</li>
</ul>
<p>
All messages can be customized if the default message doesn't suit you.
Please <a href="config.html#Custom_messages">see the documentation</a> to learn how to.
</p>
</subsection>
<subsection name="Package">
<p> com.puppycrawl.tools.checkstyle.checks.naming </p>
</subsection>
<subsection name="Parent Module">
<p> <a href="config.html#TreeWalker">TreeWalker</a> </p>
</subsection>
</section>
<section name="MethodName">
<subsection name="Description">
<p>Since Checkstyle 3.0</p>
<p>
Validates identifiers for methods.
</p>
</subsection>
<subsection name="Properties">
<table>
<tr>
<th>name</th>
<th>description</th>
<th>type</th>
<th>default value</th>
<th>since</th>
</tr>
<tr>
<td>format</td>
<td>Specifies valid identifiers.</td>
<td><a href="property_types.html#regexp">Regular Expression</a></td>
<td><code>"^[a-z][a-zA-Z0-9]*$"</code></td>
<td>3.0</td>
</tr>
<tr>
<td>allowClassName</td>
<td>
Controls whether to allow a method name to have the same
name as the residing class name. This is not to be confused
with a constructor. An easy mistake is to place a return
type on a constructor declaration which turns it into a
method. For example:
<pre>
class MyClass {
public void MyClass() {} //this is a method
public MyClass() {} //this is a constructor
}
</pre>
</td>
<td><a href="property_types.html#boolean">Boolean</a></td>
<td><code>false</code></td>
<td>5.0</td>
</tr>
<tr>
<td>applyToPublic</td>
<td>Controls whether to apply the check to public member.</td>
<td><a href="property_types.html#boolean">Boolean</a></td>
<td><code>true</code></td>
<td>5.1</td>
</tr>
<tr>
<td>applyToProtected</td>
<td>Controls whether to apply the check to protected member.</td>
<td><a href="property_types.html#boolean">Boolean</a></td>
<td><code>true</code></td>
<td>5.1</td>
</tr>
<tr>
<td>applyToPackage</td>
<td>
Controls whether to apply the check to package-private member.
</td>
<td><a href="property_types.html#boolean">Boolean</a></td>
<td><code>true</code></td>
<td>5.1</td>
</tr>
<tr>
<td>applyToPrivate</td>
<td>Controls whether to apply the check to private member.</td>
<td><a href="property_types.html#boolean">Boolean</a></td>
<td><code>true</code></td>
<td>5.1</td>
</tr>
</table>
</subsection>
<subsection name="Examples">
<p>
To configure the check:
</p>
<source>
&lt;module name=&quot;MethodName&quot;/&gt;
</source>
</subsection>
<subsection name="Example of Usage">
<ul>
<li>
<a href="https://github.com/search?q=path%3Asrc%2Fmain%2Fresources+filename%3Agoogle_checks.xml+repo%3Acheckstyle%2Fcheckstyle+MethodName">
Google Style</a>
</li>
<li>
<a href="https://github.com/search?q=path%3Asrc%2Fmain%2Fresources+filename%3Asun_checks.xml+repo%3Acheckstyle%2Fcheckstyle+MethodName">
Sun Style</a>
</li>
<li>
<a href="https://github.com/search?q=path%3Aconfig+filename%3Acheckstyle_checks.xml+repo%3Acheckstyle%2Fcheckstyle+MethodName">
Checkstyle Style</a>
</li>
</ul>
</subsection>
<subsection name="Error Messages">
<ul>
<li>
<a href="https://github.com/search?q=path%3Asrc%2Fmain%2Fresources%2Fcom%2Fpuppycrawl%2Ftools%2Fcheckstyle%2Fchecks%2Fnaming+filename%3Amessages*.properties+repo%3Acheckstyle%2Fcheckstyle+%22method.name.equals.class.name%22">
method.name.equals.class.name</a>
</li>
<li>
<a href="https://github.com/search?q=path%3Asrc%2Fmain%2Fresources%2Fcom%2Fpuppycrawl%2Ftools%2Fcheckstyle%2Fchecks%2Fnaming+filename%3Amessages*.properties+repo%3Acheckstyle%2Fcheckstyle+%22name.invalidPattern%22">
name.invalidPattern</a>
</li>
</ul>
<p>
All messages can be customized if the default message doesn't suit you.
Please <a href="config.html#Custom_messages">see the documentation</a> to learn how to.
</p>
</subsection>
<subsection name="Package">
<p> com.puppycrawl.tools.checkstyle.checks.naming </p>
</subsection>
<subsection name="Parent Module">
<p> <a href="config.html#TreeWalker">TreeWalker</a> </p>
</subsection>
</section>
<section name="MethodTypeParameterName">
<subsection name="Description">
<p>Since Checkstyle 5.0</p>
<p>
Validates identifiers for method type parameters.
</p>
</subsection>
<subsection name="Properties">
<table>
<tr>
<th>name</th>
<th>description</th>
<th>type</th>
<th>default value</th>
<th>since</th>
</tr>
<tr>
<td>format</td>
<td>Specifies valid identifiers.</td>
<td><a href="property_types.html#regexp">Regular Expression</a></td>
<td><code>"^[A-Z]$"</code></td>
<td>5.0</td>
</tr>
</table>
</subsection>
<subsection name="Examples">
<p>
To configure the check:
</p>
<source>
&lt;module name=&quot;MethodTypeParameterName&quot;/&gt;
</source>
</subsection>
<subsection name="Example of Usage">
<ul>
<li>
<a href="https://github.com/search?q=path%3Asrc%2Fmain%2Fresources+filename%3Agoogle_checks.xml+repo%3Acheckstyle%2Fcheckstyle+MethodTypeParameterName">
Google Style</a>
</li>
<li>
<a href="https://github.com/search?q=path%3Aconfig+filename%3Acheckstyle_checks.xml+repo%3Acheckstyle%2Fcheckstyle+MethodTypeParameterName">
Checkstyle Style</a>
</li>
</ul>
</subsection>
<subsection name="Error Messages">
<ul>
<li>
<a href="https://github.com/search?q=path%3Asrc%2Fmain%2Fresources%2Fcom%2Fpuppycrawl%2Ftools%2Fcheckstyle%2Fchecks%2Fnaming+filename%3Amessages*.properties+repo%3Acheckstyle%2Fcheckstyle+%22name.invalidPattern%22">
name.invalidPattern</a>
</li>
</ul>
<p>
All messages can be customized if the default message doesn't suit you.
Please <a href="config.html#Custom_messages">see the documentation</a> to learn how to.
</p>
</subsection>
<subsection name="Package">
<p> com.puppycrawl.tools.checkstyle.checks.naming </p>
</subsection>
<subsection name="Parent Module">
<p> <a href="config.html#TreeWalker">TreeWalker</a> </p>
</subsection>
</section>
<section name="PackageName">
<subsection name="Description">
<p>Since Checkstyle 3.0</p>
<p>
Validates identifiers for packages.
</p>
</subsection>
<subsection name="Properties">
<table>
<tr>
<th>name</th>
<th>description</th>
<th>type</th>
<th>default value</th>
<th>since</th>
</tr>
<tr>
<td>format</td>
<td>Specifies valid identifiers.</td>
<td><a href="property_types.html#regexp">Regular Expression</a></td>
<td><code>"^[a-z]+(\.[a-zA-Z_][a-zA-Z0-9_]*)*$"</code></td>
<td>3.0</td>
</tr>
</table>
</subsection>
<subsection name="Examples">
<p>
The default value of <code>format</code> for module <code>PackageName</code> has been chosen to match the
requirements in the <a
href="https://docs.oracle.com/javase/specs/jls/se8/html/jls-6.html#jls-6.5.3">Java
Language specification</a> and the Sun coding conventions. However
both underscores and uppercase letters are rather uncommon, so most
configurations should probably assign value <code>^[a-z]+(\.[a-z][a-z0-9]*)*$</code> to <code>format</code> for module <code>PackageName</code>, as in
</p>
<source>
&lt;module name=&quot;PackageName&quot;&gt;
&lt;property name=&quot;format&quot;
value=&quot;^[a-z]+(\.[a-z][a-z0-9]*)*$&quot;/&gt;
&lt;/module&gt;
</source>
</subsection>
<subsection name="Example of Usage">
<ul>
<li>
<a href="https://github.com/search?q=path%3Asrc%2Fmain%2Fresources+filename%3Agoogle_checks.xml+repo%3Acheckstyle%2Fcheckstyle+PackageName">
Google Style</a>
</li>
<li>
<a href="https://github.com/search?q=path%3Asrc%2Fmain%2Fresources+filename%3Asun_checks.xml+repo%3Acheckstyle%2Fcheckstyle+PackageName">
Sun Style</a>
</li>
<li>
<a href="https://github.com/search?q=path%3Aconfig+filename%3Acheckstyle_checks.xml+repo%3Acheckstyle%2Fcheckstyle+PackageName">
Checkstyle Style</a>
</li>
</ul>
</subsection>
<subsection name="Error Messages">
<ul>
<li>
<a href="https://github.com/search?q=path%3Asrc%2Fmain%2Fresources%2Fcom%2Fpuppycrawl%2Ftools%2Fcheckstyle%2Fchecks%2Fnaming+filename%3Amessages*.properties+repo%3Acheckstyle%2Fcheckstyle+%22name.invalidPattern%22">
name.invalidPattern</a>
</li>
</ul>
<p>
All messages can be customized if the default message doesn't suit you.
Please <a href="config.html#Custom_messages">see the documentation</a> to learn how to.
</p>
</subsection>
<subsection name="Package">
<p> com.puppycrawl.tools.checkstyle.checks.naming </p>
</subsection>
<subsection name="Parent Module">
<p> <a href="config.html#TreeWalker">TreeWalker</a> </p>
</subsection>
</section>
<section name="ParameterName">
<subsection name="Description">
<p>Since Checkstyle 3.0</p>
<p>
Checks that method and <code>catch</code> parameter names conform to a format specified
by the format property. By using <code>accessModifiers</code> property it is possible
to specify different formats for methods at different visibility levels.
</p>
</subsection>
<subsection name="Properties">
<table>
<tr>
<th>name</th>
<th>description</th>
<th>type</th>
<th>default value</th>
<th>since</th>
</tr>
<tr>
<td>format</td>
<td>Specifies valid identifiers.</td>
<td><a href="property_types.html#regexp">Regular Expression</a></td>
<td><code>"^[a-z][a-zA-Z0-9]*$"</code></td>
<td>3.0</td>
</tr>
<tr>
<td>ignoreOverridden</td>
<td>
Allows to skip methods with Override annotation from validation. For example, the
following method's parameter will be skipped from validation, if
ignoreOverridden is true:
<pre>
@Override
public boolean equals(Object o) {
return super.equals(o);
}
</pre>
</td>
<td><a href="property_types.html#boolean">Boolean</a></td>
<td><code>false</code></td>
<td>6.12.1</td>
</tr>
<tr>
<td>accessModifiers</td>
<td>Access modifiers of methods where parameters are checked.</td>
<td><a href="property_types.html#access_modifiers">Access Modifier Set</a></td>
<td><code>public, protected, package, private</code></td>
<td>7.5</td>
</tr>
</table>
</subsection>
<subsection name="Examples">
<p>
To configure the check:
</p>
<source>
&lt;module name=&quot;ParameterName&quot;/&gt;
</source>
<p>
An example of how to configure the check to skip methods with Override annotation from
validation:
</p>
<source>
&lt;module name="ParameterName"&gt;
&lt;property name="ignoreOverridden" value="true"/&gt;
&lt;/module&gt;
</source>
<p>
An example of how to configure the check for names that begin with
a lower case letter, followed by letters and digits is:
</p>
<source>
&lt;module name="ParameterName"&gt;
&lt;property name="format" value="^[a-z][a-zA-Z0-9]+$"/&gt;
&lt;/module&gt;
</source>
<p>
The following configuration checks that the parameters always start with two
lowercase characters and, in addition, that public method parameters cannot be one character
long:
</p>
<source>
&lt;module name=&quot;ParameterName&quot;&gt;
&lt;property name=&quot;format&quot; value=&quot;^[a-z]([a-z0-9][a-zA-Z0-9]*)?$&quot;/&gt;
&lt;property name=&quot;accessModifiers&quot; value=&quot;protected, package, private&quot;/&gt;
&lt;message key=&quot;name.invalidPattern&quot;
value=&quot;Parameter name ''{0}'' must match pattern ''{1}''&quot;/&gt;
&lt;/module&gt;
&lt;module name=&quot;ParameterName&quot;&gt;
&lt;property name=&quot;format&quot; value=&quot;^[a-z][a-z0-9][a-zA-Z0-9]*$&quot;/&gt;
&lt;property name=&quot;accessModifiers&quot; value=&quot;public&quot;/&gt;
&lt;message key=&quot;name.invalidPattern&quot;
value=&quot;Parameter name ''{0}'' must match pattern ''{1}''&quot;/&gt;
&lt;/module&gt;
</source>
</subsection>
<subsection name="Example of Usage">
<ul>
<li>
<a href="https://github.com/search?q=path%3Asrc%2Fmain%2Fresources+filename%3Agoogle_checks.xml+repo%3Acheckstyle%2Fcheckstyle+ParameterName">
Google Style</a>
</li>
<li>
<a href="https://github.com/search?q=path%3Asrc%2Fmain%2Fresources+filename%3Asun_checks.xml+repo%3Acheckstyle%2Fcheckstyle+ParameterName">
Sun Style</a>
</li>
<li>
<a href="https://github.com/search?q=path%3Aconfig+filename%3Acheckstyle_checks.xml+repo%3Acheckstyle%2Fcheckstyle+ParameterName">
Checkstyle Style</a>
</li>
</ul>
</subsection>
<subsection name="Error Messages">
<ul>
<li>
<a href="https://github.com/search?q=path%3Asrc%2Fmain%2Fresources%2Fcom%2Fpuppycrawl%2Ftools%2Fcheckstyle%2Fchecks%2Fnaming+filename%3Amessages*.properties+repo%3Acheckstyle%2Fcheckstyle+%22name.invalidPattern%22">
name.invalidPattern</a>
</li>
</ul>
<p>
All messages can be customized if the default message doesn't suit you.
Please <a href="config.html#Custom_messages">see the documentation</a> to learn how to.
</p>
</subsection>
<subsection name="Package">
<p> com.puppycrawl.tools.checkstyle.checks.naming </p>
</subsection>
<subsection name="Parent Module">
<p> <a href="config.html#TreeWalker">TreeWalker</a> </p>
</subsection>
</section>
<section name="StaticVariableName">
<subsection name="Description">
<p>Since Checkstyle 3.0</p>
<p>
Validates identifiers for <code>static</code>, non-<code>final</code> fields.
</p>
</subsection>
<subsection name="Properties">
<table>
<tr>
<th>name</th>
<th>description</th>
<th>type</th>
<th>default value</th>
<th>since</th>
</tr>
<tr>
<td>format</td>
<td>Specifies valid identifiers.</td>
<td><a href="property_types.html#regexp">Regular Expression</a></td>
<td><code>"^[a-z][a-zA-Z0-9]*$"</code></td>
<td>3.0</td>
</tr>
<tr>
<td>applyToPublic</td>
<td>Controls whether to apply the check to public member.</td>
<td><a href="property_types.html#boolean">Boolean</a></td>
<td><code>true</code></td>
<td>5.0</td>
</tr>
<tr>
<td>applyToProtected</td>
<td>Controls whether to apply the check to protected member.</td>
<td><a href="property_types.html#boolean">Boolean</a></td>
<td><code>true</code></td>
<td>5.0</td>
</tr>
<tr>
<td>applyToPackage</td>
<td>
Controls whether to apply the check to package-private member.
</td>
<td><a href="property_types.html#boolean">Boolean</a></td>
<td><code>true</code></td>
<td>5.0</td>
</tr>
<tr>
<td>applyToPrivate</td>
<td>Controls whether to apply the check to private member.</td>
<td><a href="property_types.html#boolean">Boolean</a></td>
<td><code>true</code></td>
<td>5.0</td>
</tr>
</table>
</subsection>
<subsection name="Examples">
<p>
To configure the check:
</p>
<source>
&lt;module name=&quot;StaticVariableName&quot;/&gt;
</source>
</subsection>
<subsection name="Example of Usage">
<ul>
<li>
<a href="https://github.com/search?q=path%3Asrc%2Fmain%2Fresources+filename%3Asun_checks.xml+repo%3Acheckstyle%2Fcheckstyle+StaticVariableName">
Sun Style</a>
</li>
<li>
<a href="https://github.com/search?q=path%3Aconfig+filename%3Acheckstyle_checks.xml+repo%3Acheckstyle%2Fcheckstyle+StaticVariableName">
Checkstyle Style</a>
</li>
</ul>
</subsection>
<subsection name="Error Messages">
<ul>
<li>
<a href="https://github.com/search?q=path%3Asrc%2Fmain%2Fresources%2Fcom%2Fpuppycrawl%2Ftools%2Fcheckstyle%2Fchecks%2Fnaming+filename%3Amessages*.properties+repo%3Acheckstyle%2Fcheckstyle+%22name.invalidPattern%22">
name.invalidPattern</a>
</li>
</ul>
<p>
All messages can be customized if the default message doesn't suit you.
Please <a href="config.html#Custom_messages">see the documentation</a> to learn how to.
</p>
</subsection>
<subsection name="Package">
<p> com.puppycrawl.tools.checkstyle.checks.naming </p>
</subsection>
<subsection name="Parent Module">
<p> <a href="config.html#TreeWalker">TreeWalker</a> </p>
</subsection>
</section>
<section name="TypeName">
<subsection name="Description">
<p>Since Checkstyle 3.0</p>
<p>
Validates identifiers for classes, interfaces, enums, and annotations.
</p>
</subsection>
<subsection name="Properties">
<table>
<tr>
<th>name</th>
<th>description</th>
<th>type</th>
<th>default value</th>
<th>since</th>
</tr>
<tr>
<td>format</td>
<td>Specifies valid identifiers.</td>
<td><a href="property_types.html#regexp">Regular Expression</a></td>
<td><code>"^[A-Z][a-zA-Z0-9]*$"</code></td>
<td>3.0</td>
</tr>
<tr>
<td>applyToPublic</td>
<td>Controls whether to apply the check to public member.</td>
<td><a href="property_types.html#boolean">Boolean</a></td>
<td><code>true</code></td>
<td>5.0</td>
</tr>
<tr>
<td>applyToProtected</td>
<td>Controls whether to apply the check to protected member.</td>
<td><a href="property_types.html#boolean">Boolean</a></td>
<td><code>true</code></td>
<td>5.0</td>
</tr>
<tr>
<td>applyToPackage</td>
<td>
Controls whether to apply the check to package-private member.
</td>
<td><a href="property_types.html#boolean">Boolean</a></td>
<td><code>true</code></td>
<td>5.0</td>
</tr>
<tr>
<td>applyToPrivate</td>
<td>Controls whether to apply the check to private member.</td>
<td><a href="property_types.html#boolean">Boolean</a></td>
<td><code>true</code></td>
<td>5.0</td>
</tr>
<tr>
<td>tokens</td>
<td>tokens to check</td>
<td>
subset of tokens
<a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#CLASS_DEF">
CLASS_DEF</a>,
<a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#INTERFACE_DEF">
INTERFACE_DEF</a>,
<a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#ENUM_DEF">
ENUM_DEF</a>,
<a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#ANNOTATION_DEF">
ANNOTATION_DEF</a>.
</td>
<td>
<a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#CLASS_DEF">
CLASS_DEF</a>,
<a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#INTERFACE_DEF">
INTERFACE_DEF</a>,
<a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#ENUM_DEF">
ENUM_DEF</a>,
<a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#ANNOTATION_DEF">
ANNOTATION_DEF</a>.
</td>
<td>3.0</td>
</tr>
</table>
</subsection>
<subsection name="Examples">
<p>
The following configuration element ensures that
interface names begin with <code>"I_"</code>, followed by
letters and digits:
</p>
<source>
&lt;module name=&quot;TypeName&quot;&gt;
&lt;property name=&quot;format&quot;
value=&quot;^I_[a-zA-Z0-9]*$&quot;/&gt;
&lt;property name=&quot;tokens&quot;
value=&quot;INTERFACE_DEF&quot;/&gt;
&lt;/module&gt;
</source>
</subsection>
<subsection name="Example of Usage">
<ul>
<li>
<a href="https://github.com/search?q=path%3Asrc%2Fmain%2Fresources+filename%3Agoogle_checks.xml+repo%3Acheckstyle%2Fcheckstyle+TypeName">
Google Style</a>
</li>
<li>
<a href="https://github.com/search?q=path%3Asrc%2Fmain%2Fresources+filename%3Asun_checks.xml+repo%3Acheckstyle%2Fcheckstyle+TypeName">
Sun Style</a>
</li>
<li>
<a href="https://github.com/search?q=path%3Aconfig+filename%3Acheckstyle_checks.xml+repo%3Acheckstyle%2Fcheckstyle+TypeName">
Checkstyle Style</a>
</li>
</ul>
</subsection>
<subsection name="Error Messages">
<ul>
<li>
<a href="https://github.com/search?q=path%3Asrc%2Fmain%2Fresources%2Fcom%2Fpuppycrawl%2Ftools%2Fcheckstyle%2Fchecks%2Fnaming+filename%3Amessages*.properties+repo%3Acheckstyle%2Fcheckstyle+%22name.invalidPattern%22">
name.invalidPattern</a>
</li>
</ul>
<p>
All messages can be customized if the default message doesn't suit you.
Please <a href="config.html#Custom_messages">see the documentation</a> to learn how to.
</p>
</subsection>
<subsection name="Package">
<p> com.puppycrawl.tools.checkstyle.checks.naming </p>
</subsection>
<subsection name="Parent Module">
<p> <a href="config.html#TreeWalker">TreeWalker</a> </p>
</subsection>
</section>
</body>
</document>