checkstyle/docs/property_types.html

301 lines
7.6 KiB
HTML

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Property Types</title>
<link rel="stylesheet" type="text/css" href="mystyle.css" />
</head>
<body>
<h1>Property Types</h1>
<p>Checkstyle is configured using properties, which are string
representations. This document describes how these string representations are
mapped to typed properties.</p>
<h2><a name="integer">Integer</a></h2>
<p>This property represents an integer. The string representation is parsed
using the <span class="code">java.lang.Integer</span> class.</p>
<h2><a name="string">String</a></h2>
<p>This property represents a string. The literal string representation is
used.</p>
<h2><a name="boolean">Boolean</a></h2>
<p>This property represents a boolean. The default value is <span
class="code">false</span>. The following string representations will map to
<span class="code">true</span>:</p>
<ul>
<li><span class="code">yes</span></li>
<li><span class="code">true</span></li>
<li><span class="code">on</span></li>
</ul>
<p>Anything else will map to <span class="code">false</span>.</p>
<h2><a name="stringSet">String Set</a></h2>
<p>This property represents a set of strings. The string representation is
parsed as a set of comma (',') separated strings.</p>
<h2><a name="intSet">Integer Set</a></h2>
<p>This property represents a set of integers. The string representation is
parsed as a set of comma (',') separated integers that are parsed using the
<span class="code">java.lang.Integer</span> class.</p>
<h2><a name="regexp">Regular Expression</a></h2>
<p>This property represents a regular expression. The string representation is
parsed using the excellent <a href="http://jakarta.apache.org/regexp/">Jakarta
Regexp</a> library.</p>
<h2><a name="parenPad">Pad Policy</a></h2>
<p>This property represents the policy for padding with white space. The
following table describes the valid options:</p>
<table border="1" summary="padding options">
<tr class="header">
<td>Option</td>
<td>Definition</td>
</tr>
<tr>
<td><span class="code">nospace</span></td>
<td>Do not pad. For example, <span class="code">method(a, b);</span></td>
</tr>
<tr>
<td><span class="code">space</span></td>
<td>Ensure padding. For example, <span class="code">method( a, b );</span></td>
</tr>
</table>
<h2><a name="wrapOp">Operator Wrap Policy</a></h2>
<p>This property represents the policy for wrapping lines on operators. The
following table describes the valid options:</p>
<table border="1" summary="wrap operator options">
<tr class="header">
<td>Option</td>
<td>Definition</td>
</tr>
<tr>
<td><span class="code">nl</span></td>
<td>The operator must be on a new line. For example:
<pre>
someVariable = aBigVariableNameToMakeThings + "this may work"
+ lookVeryInteresting;
</pre>
</td>
</tr>
<tr>
<td><span class="code">eol</span></td>
<td>The operator must be at the end of the line. For example:
<pre>
someVariable = aBigVariableNameToMakeThings + "this may work" +
lookVeryInteresting;
</pre>
</td>
</tr>
</table>
<h2><a name="block">Block Policy</a></h2>
<p>This property represents the policy for checking block statements. The
following table describes the valid options:</p>
<table border="1" summary="block options">
<tr class="header">
<td>Option</td>
<td>Definition</td>
</tr>
<tr>
<td><span class="code">text</span></td>
<td>Require that there is some text in the block. For example:
<pre>
catch (Exception ex) {
// This is a bad coding practice
}
</pre>
</td>
</tr>
<tr>
<td><span class="code">stmt</span></td>
<td>Require that there is a statement in the block. For example:
<pre>
finally {
lock.release();
}
</pre>
</td>
</tr>
</table>
<h2><a name="lcurly">left curly brace policy</a></h2>
<p>This property represents the policy for checking the placement of a left
curly brace (<span class="code">'{'</span>). The following table describes the
valid options:</p>
<table border="1" summary="left curly options">
<tr class="header">
<td>Option</td>
<td>Definition</td>
</tr>
<tr>
<td><span class="code">eol</span></td>
<td>The brace must always be on the end of the line. For example:
<pre>
if (condition) {
...
</pre>
</td>
</tr>
<tr>
<td><span class="code">nl</span></td>
<td>The brace must always be on a new line. For example:
<pre>
if (condition)
{
...
</pre>
</td>
</tr>
<tr>
<td><span class="code">nlow</span></td>
<td>If the brace will fit on the first line of the statement, taking into account maximum line length, then apply <span class="code">eol</span> rule. Otherwise apply the <span class="code">nl</span> rule. <span class="code">nlow</span> is a mnemonic for "new line on wrap". For the example above Checkstyle will enforce:
<pre>
if (condition) {
...
</pre>
But for a statement spanning multiple lines, Checkstyle will enforce:
<pre>
if (condition1 &amp;&amp; condition2 &amp;&amp;
condition3 &amp;&amp; condition4)
{
...
</pre>
</td>
</tr>
</table>
<h2><a name="rcurly">right curly brace policy</a></h2>
<p>This property represents the policy for checking the placement of a right
curly brace (<span class="code">'}'</span>). The following table describes the
valid options:</p>
<table border="1" summary="right curly options">
<tr class="header">
<td>Option</td>
<td>Definition</td>
</tr>
<tr>
<td><span class="code">same</span></td>
<td>The brace must be on the same line as the next statement. For example:
<pre>
try {
...
} finally {
</pre>
</td>
</tr>
<tr>
<td><span class="code">alone</span></td>
<td>The brace must be alone on the line. For example:
<pre>
try {
...
}
finally {
</pre>
</td>
</tr>
</table>
<h2><a name="scope">Scope</a></h2>
<p>This property represents a Java scope. The valid options are:</p>
<ul>
<li><span class="default">nothing</span></li>
<li><span class="default">public</span></li>
<li><span class="default">protected</span></li>
<li><span class="default">package</span></li>
<li><span class="default">private</span></li>
<li><span class="default">anoninner</span></li>
</ul>
<h2><a name="severity">Severity</a></h2>
<p>This property represents the severity level of a check violation. The valid options are:</p>
<ul>
<li><span class="default">ignore</span></li>
<li><span class="default">info</span></li>
<li><span class="default">warning</span></li>
<li><span class="default">error</span></li>
</ul>
<h2><a name="persistence">persistence policy</a></h2>
<p>This property represents the policy for checking entity beans according
to whether the beans have bean-managed persistence, container-managed persistence,
or mixed persistence:</p>
<table border="1" summary="right curly options">
<tr class="header">
<td>Option</td>
<td>Definition</td>
</tr>
<tr>
<td><span class="code">bean</span></td>
<td>The beans have bean-managed persistence.</td>
</tr>
<tr>
<td><span class="code">container</span></td>
<td>The beans have container-managed persistence.</td>
</tr>
<tr>
<td><span class="code">mixed</span></td>
<td>The beans have mixed bean-managed and container-managed persistence.</td>
</tr>
</table>
<hr />
<div><a href="index.html">Back to the Checkstyle Home Page</a></div>
<p class="copyright">Copyright &copy; 2002-2004 Oliver Burn. All rights Reserved.</p>
</body>
</html>