Update documentation
https://github.com/pmd/pmd/actions/runs/3350576465
66e834049f...5a4bf05493
This commit is contained in:
@@ -174,7 +174,7 @@
|
||||
|
||||
|
||||
<ul id="mysidebar" class="nav">
|
||||
<li class="sidebarTitle">PMD 6.51.0-SNAPSHOT</li>
|
||||
<li class="sidebarTitle">PMD 6.51.0</li>
|
||||
<div class="sidebarTitleDate">Release date: 29-October-2022</div>
|
||||
|
||||
|
||||
@@ -1576,16 +1576,16 @@ page can help you squeeze that sweet flexibility out of your rule.</p>
|
||||
<p>The procedure to define a property is quite straightforward:</p>
|
||||
<ul>
|
||||
<li>Create a property descriptor of the type you want, by using a
|
||||
builder from <a href="https://docs.pmd-code.org/apidocs/pmd-core/6.51.0-SNAPSHOT/net/sourceforge/pmd/properties/PropertyFactory.html#"><code>PropertyFactory</code></a></li>
|
||||
<li>Call <a href="https://docs.pmd-code.org/apidocs/pmd-core/6.51.0-SNAPSHOT/net/sourceforge/pmd/properties/PropertySource.html#definePropertyDescriptor(net.sourceforge.pmd.properties.PropertyDescriptor)"><code>definePropertyDescriptor(PropertyDescriptor)</code></a>` in the rule’s noarg constructor.</li>
|
||||
builder from <a href="https://docs.pmd-code.org/apidocs/pmd-core/6.51.0/net/sourceforge/pmd/properties/PropertyFactory.html#"><code>PropertyFactory</code></a></li>
|
||||
<li>Call <a href="https://docs.pmd-code.org/apidocs/pmd-core/6.51.0/net/sourceforge/pmd/properties/PropertySource.html#definePropertyDescriptor(net.sourceforge.pmd.properties.PropertyDescriptor)"><code>definePropertyDescriptor(PropertyDescriptor)</code></a>` in the rule’s noarg constructor.</li>
|
||||
</ul>
|
||||
|
||||
<p>You can then retrieve the value of the property at any time using <a href="https://docs.pmd-code.org/apidocs/pmd-core/6.51.0-SNAPSHOT/net/sourceforge/pmd/properties/PropertySource.html#getProperty(net.sourceforge.pmd.properties.PropertyDescriptor)"><code>getProperty(PropertyDescriptor)</code></a>.</p>
|
||||
<p>You can then retrieve the value of the property at any time using <a href="https://docs.pmd-code.org/apidocs/pmd-core/6.51.0/net/sourceforge/pmd/properties/PropertySource.html#getProperty(net.sourceforge.pmd.properties.PropertyDescriptor)"><code>getProperty(PropertyDescriptor)</code></a>.</p>
|
||||
|
||||
<h3 id="creating-a-descriptor">Creating a descriptor</h3>
|
||||
|
||||
<p>Properties can be built using type-specific <strong>builders</strong>, which can be obtained
|
||||
from the factory methods of <a href="https://docs.pmd-code.org/apidocs/pmd-core/6.51.0-SNAPSHOT/net/sourceforge/pmd/properties/PropertyFactory.html#"><code>PropertyFactory</code></a>. For example, to build a
|
||||
from the factory methods of <a href="https://docs.pmd-code.org/apidocs/pmd-core/6.51.0/net/sourceforge/pmd/properties/PropertyFactory.html#"><code>PropertyFactory</code></a>. For example, to build a
|
||||
string property, you’d call</p>
|
||||
<div class="language-java highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nc">PropertyFactory</span><span class="o">.</span><span class="na">stringProperty</span><span class="o">(</span><span class="s">"myProperty"</span><span class="o">)</span>
|
||||
<span class="o">.</span><span class="na">desc</span><span class="o">(</span><span class="s">"This is my property"</span><span class="o">)</span>
|
||||
@@ -1608,8 +1608,8 @@ information about how to migrate.</div>
|
||||
<span class="o">.</span><span class="na">build</span><span class="o">();</span>
|
||||
</code></pre></div></div>
|
||||
|
||||
<p>The <a href="https://docs.pmd-code.org/apidocs/pmd-core/6.51.0-SNAPSHOT/net/sourceforge/pmd/properties/constraints/NumericConstraints.html#positive()"><code>positive</code></a> method is part of
|
||||
the <a href="https://docs.pmd-code.org/apidocs/pmd-core/6.51.0-SNAPSHOT/net/sourceforge/pmd/properties/constraints/NumericConstraints.html#"><code>NumericConstraints</code></a> class, which provides some
|
||||
<p>The <a href="https://docs.pmd-code.org/apidocs/pmd-core/6.51.0/net/sourceforge/pmd/properties/constraints/NumericConstraints.html#positive()"><code>positive</code></a> method is part of
|
||||
the <a href="https://docs.pmd-code.org/apidocs/pmd-core/6.51.0/net/sourceforge/pmd/properties/constraints/NumericConstraints.html#"><code>NumericConstraints</code></a> class, which provides some
|
||||
other constraints. The constraint mechanism will be completely unlocked with 7.0.0,
|
||||
since we’ll be migrating our API to Java 8.</p>
|
||||
|
||||
@@ -1640,7 +1640,7 @@ There are several things to notice here:</p>
|
||||
<ul>
|
||||
<li>The property descriptors are declared <code class="language-plaintext highlighter-rouge">static final</code>, which should generally be
|
||||
the case, as descriptors are immutable and can be shared between instances of the same rule;</li>
|
||||
<li>The property is declared using <a href="https://docs.pmd-code.org/apidocs/pmd-core/6.51.0-SNAPSHOT/net/sourceforge/pmd/properties/PropertySource.html#definePropertyDescriptor(net.sourceforge.pmd.properties.PropertyDescriptor)"><code>definePropertyDescriptor</code></a>` <em>in the constructor</em>,
|
||||
<li>The property is declared using <a href="https://docs.pmd-code.org/apidocs/pmd-core/6.51.0/net/sourceforge/pmd/properties/PropertySource.html#definePropertyDescriptor(net.sourceforge.pmd.properties.PropertyDescriptor)"><code>definePropertyDescriptor</code></a>` <em>in the constructor</em>,
|
||||
which ensures the property gets recognised by PMD at the time the properties
|
||||
are overridden (which happens before rule execution);</li>
|
||||
<li>The value of the property is <em>not retrieved in the constructor</em>, but in one of
|
||||
@@ -1794,7 +1794,7 @@ are supported.</p>
|
||||
©2022 PMD Open Source Project. All rights
|
||||
reserved. <br />
|
||||
<span>Page last updated:</span>
|
||||
February 2020 (6.22.0)<br /> Site last generated: Oct 28, 2022 <br />
|
||||
February 2020 (6.22.0)<br /> Site last generated: Oct 29, 2022 <br />
|
||||
<p>
|
||||
<img src="images/pmd-logo-small.png" alt="Company
|
||||
logo"/>
|
||||
|
Reference in New Issue
Block a user