mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-16 22:51:17 +07:00
47 lines
1.1 KiB
HTML
47 lines
1.1 KiB
HTML
<html>
|
|
<body>
|
|
Reports calls to a simple property getter from within the property's class.
|
|
<p>
|
|
A simple property getter is defined as one which simply returns the value of a field,
|
|
and does no other calculations. Such simple getter calls can be safely inlined using the quick-fix.
|
|
Some coding standards also suggest against the use of simple getters for code clarity reasons.
|
|
</p>
|
|
<p><b>Example:</b></p>
|
|
<pre><code>
|
|
public class Salient {
|
|
private String name;
|
|
|
|
public String getName() {
|
|
return name;
|
|
}
|
|
|
|
@Override
|
|
public String toString() {
|
|
return getName();
|
|
}
|
|
}
|
|
</code></pre>
|
|
<p>After the quick-fix is applied:</p>
|
|
<pre><code>
|
|
public class Salient {
|
|
private String name;
|
|
|
|
public String getName() {
|
|
return name;
|
|
}
|
|
|
|
@Override
|
|
public String toString() {
|
|
return name;
|
|
}
|
|
}
|
|
</code></pre>
|
|
<!-- tooltip end -->
|
|
<p>Use the following options to configure the inspection:</p>
|
|
<ul>
|
|
<li>Whether to only report getter calls on <code>this</code>, not on objects of the same type passed in as a parameter.</li>
|
|
<li>Whether to ignore non-<code>private</code> getters.</li>
|
|
</ul>
|
|
|
|
</body>
|
|
</html> |