org.codenarc.rule
Class AbstractSharedAstVisitorRule

java.lang.Object
  extended by org.codenarc.rule.AbstractRule
      extended by org.codenarc.rule.AbstractAstVisitorRule
          extended by org.codenarc.rule.AbstractSharedAstVisitorRule
All Implemented Interfaces:
Rule
Direct Known Subclasses:
PrivateFieldCouldBeFinalRule, UnusedPrivateFieldRule, UnusedPrivateMethodRule

public abstract class AbstractSharedAstVisitorRule
extends AbstractAstVisitorRule

Abstract superclass for Rules that use a single, shared AstVisitor across all ClassNodes in a source (file).

Author:
Chris Mair

Field Summary
 
Fields inherited from class org.codenarc.rule.AbstractAstVisitorRule
DEFAULT_CONST_NAME, DEFAULT_FIELD_NAME, DEFAULT_TEST_CLASS_NAMES, DEFAULT_TEST_FILES, DEFAULT_VAR_NAME
 
Constructor Summary
AbstractSharedAstVisitorRule()
           
 
Method Summary
 void applyTo(SourceCode sourceCode, List violations)
          Apply this rule to the specified source and return a list of violations (or an empty List)
protected  void applyVisitor(AstVisitor visitor, SourceCode sourceCode)
           
protected  AstVisitor getAstVisitor(SourceCode sourceCode)
          Subclasses can override to provide an AstVisitor with SourceCode or AST-specific initialization.
protected abstract  List<Violation> getViolations(AstVisitor astVisitor, SourceCode sourceCode)
           
 
Methods inherited from class org.codenarc.rule.AbstractAstVisitorRule
getApplyToClassNames, getAstVisitor, getAstVisitorClass, getDoNotApplyToClassNames, setApplyToClassNames, setDoNotApplyToClassNames, shouldApplyThisRuleTo
 
Methods inherited from class org.codenarc.rule.AbstractRule
applyTo, createViolation, createViolation, createViolation, createViolation, createViolation, createViolationForImport, createViolationForImport, createViolationForImport, getApplyToFileNames, getApplyToFilesMatching, getDescription, getDoNotApplyToFileNames, getDoNotApplyToFilesMatching, getName, getPriority, getViolationMessage, isEnabled, isReady, setApplyToFileNames, setApplyToFilesMatching, setDescription, setDoNotApplyToFileNames, setDoNotApplyToFilesMatching, setEnabled, setName, setPriority, setViolationMessage, toString, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AbstractSharedAstVisitorRule

public AbstractSharedAstVisitorRule()
Method Detail

getViolations

protected abstract List<Violation> getViolations(AstVisitor astVisitor,
                                                 SourceCode sourceCode)

applyTo

public void applyTo(SourceCode sourceCode,
                    List violations)
Description copied from class: AbstractRule
Apply this rule to the specified source and return a list of violations (or an empty List)

Overrides:
applyTo in class AbstractAstVisitorRule
Parameters:
sourceCode - - the source to apply this rule to
violations - - the List of violations to which new violations from this rule are to be added

getAstVisitor

protected AstVisitor getAstVisitor(SourceCode sourceCode)
Subclasses can override to provide an AstVisitor with SourceCode or AST-specific initialization.


applyVisitor

protected void applyVisitor(AstVisitor visitor,
                            SourceCode sourceCode)


Copyright © 2012. All Rights Reserved.