class UnnecessaryGetterRule extends AbstractAstVisitorRule
Checks for explicit calls to getter/accessor methods which can, for the most part, be replaced by property access. A getter is defined as a method call that matches get[A-Z] but not getClass() or get[A-Z][A-Z] such as getURL(). Getters do not take method arguments.
If thecheckIsMethods
property is true, then also check isXxx() getters methods. Defaults to true.
The ignoreMethodNames
property optionally specifies one or more
(comma-separated) method names that should be ignored (i.e., that should not cause a
rule violation). The name(s) may optionally include wildcard characters ('*' or '?'). Fields inherited from class | Fields |
---|---|
class AbstractAstVisitorRule |
CLOSURE_TEXT, DEFAULT_CONST_NAME, DEFAULT_FIELD_NAME, DEFAULT_TEST_CLASS_NAMES, DEFAULT_TEST_FILES, DEFAULT_VAR_NAME |
Type | Name and description |
---|---|
java.lang.Class |
astVisitorClass |
boolean |
checkIsMethods |
java.lang.String |
ignoreMethodNames |
java.lang.String |
name |
int |
priority |
Constructor and description |
---|
UnnecessaryGetterRule
() |
Groovy Documentation