Package: java.org.codenarc.rule

## [Java] Class AbstractAstVisitorRule

- java.org.codenarc.rule.AbstractAstVisitorRule

- Abstract superclass for Rules that use a Groovy AST Visitor.

  Each subclass must set the `astVisitorClass` property or else define a new property with the same name, specifying the Class of the `AstVisitor` to applied to the specified source code.
  Authors:
    Chris Mair
    Hamlet D'Arcy

- - ### Field Summary

    Fields
    Modifiers | Name | Description
    --- | --- | ---
    `static String` | `CLOSURE_TEXT` |
    `protected static String` | `DEFAULT_CONST_NAME` |
    `protected static String` | `DEFAULT_FIELD_NAME` |
    `protected static String` | `DEFAULT_TEST_CLASS_NAMES` |
    `protected static String` | `DEFAULT_TEST_FILES` |
    `protected static String` | `DEFAULT_VAR_NAME` |

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `void` | `applyTo(SourceCode sourceCode, List<Violation> violations)`
    `` | `String` | `getApplyToClassNames()`
    `` | `AstVisitor` | `getAstVisitor()`
    `` | `protected Class` | `getAstVisitorClass()` Each concrete subclass must either set this property or define its own property with the same name
    `` | `String` | `getDoNotApplyToClassNames()`
    `` | `void` | `setApplyToClassNames(String applyToClassNames)`
    `` | `void` | `setDoNotApplyToClassNames(String doNotApplyToClassNames)`
    `` | `protected boolean` | `shouldApplyThisRuleTo(org.codehaus.groovy.ast.ClassNode classNode)` Return true if this rule should be applied for the specified ClassNode, based on the configuration of this rule.

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---

    `class AbstractRule`

    `applyTo, applyTo, createViolation, createViolation, createViolation, createViolation, createViolation, createViolationForImport, createViolationForImport, createViolationForImport, getApplyToFileNames, getApplyToFilesMatching, getCompilerPhase, getDescription, getDoNotApplyToFileNames, getDoNotApplyToFilesMatching, getName, getPriority, getViolationMessage, isEnabled, isReady, setApplyToFileNames, setApplyToFilesMatching, setDescription, setDoNotApplyToFileNames, setDoNotApplyToFilesMatching, setEnabled, setName, setPriority, setViolationMessage, toString, validate`

- - ### Field Detail

    - #### public static final String CLOSURE_TEXT

    - #### protected static final String DEFAULT_CONST_NAME

    - #### protected static final String DEFAULT_FIELD_NAME

    - #### protected static final String DEFAULT_TEST_CLASS_NAMES

    - #### protected static final String DEFAULT_TEST_FILES

    - #### protected static final String DEFAULT_VAR_NAME

  - ### Method Detail

    - #### @Override public void applyTo(SourceCode sourceCode, List<Violation> violations)

    - #### public String getApplyToClassNames()

    - #### public AstVisitor getAstVisitor()

    - #### protected Class getAstVisitorClass()

      Each concrete subclass must either set this property or define its own property with the same name

    - #### public String getDoNotApplyToClassNames()

    - #### public void setApplyToClassNames(String applyToClassNames)

    - #### public void setDoNotApplyToClassNames(String doNotApplyToClassNames)

    - #### protected boolean shouldApplyThisRuleTo(org.codehaus.groovy.ast.ClassNode classNode)

      Return true if this rule should be applied for the specified ClassNode, based on the configuration of this rule.

      Parameters:
        `classNode` - - the ClassNode
      Returns:
        true if this rule should be applied for the specified ClassNode