org.codenarc.rule
Class AbstractRule

java.lang.Object
  extended by org.codenarc.rule.AbstractRule
All Implemented Interfaces:
groovy.lang.GroovyObject, Rule
Direct Known Subclasses:
AbstractAstVisitorRule, DuplicateImportRule, IllegalRegexRule, ImportFromSamePackageRule, RequiredRegexRule, RequiredStringRule, UnnecessaryGroovyImportRule, UnusedImportRule

public abstract class AbstractRule
extends java.lang.Object
implements Rule, groovy.lang.GroovyObject


Constructor Summary
AbstractRule()
           
 
Method Summary
 java.util.List applyTo(SourceCode sourceCode)
           
abstract  void applyTo(SourceCode sourceCode, java.util.List violations)
           
protected  Violation createViolation(java.lang.Integer lineNumber)
           
protected  Violation createViolation(java.lang.Integer lineNumber, java.lang.String sourceLine)
           
protected  Violation createViolation(java.lang.Integer lineNumber, java.lang.String sourceLine, java.lang.String message)
           
protected  Violation createViolation(SourceCode sourceCode, org.codehaus.groovy.ast.ASTNode node)
           
protected  Violation createViolation(SourceCode sourceCode, org.codehaus.groovy.ast.ASTNode node, java.lang.Object message)
           
protected  Violation createViolationForImport(SourceCode sourceCode, org.codehaus.groovy.ast.ImportNode importNode)
           
protected  Violation createViolationForImport(SourceCode sourceCode, java.lang.String className, java.lang.String alias)
           
 java.lang.String getApplyToFileNames()
           
 java.lang.String getApplyToFilesMatching()
           
 java.lang.String getDescription()
           
 java.lang.String getDoNotApplyToFileNames()
           
 java.lang.String getDoNotApplyToFilesMatching()
           
 boolean getEnabled()
           
protected  java.util.List getImportsSortedByLineNumber(java.lang.Object sourceCode)
           
static java.lang.Object getLOG()
           
 groovy.lang.MetaClass getMetaClass()
           
abstract  java.lang.String getName()
           
abstract  int getPriority()
           
 java.lang.Object getProperty(java.lang.String property)
           
 java.lang.String getViolationMessage()
           
 java.lang.Object invokeMethod(java.lang.String method, java.lang.Object arguments)
           
 boolean isEnabled()
           
 boolean isReady()
           
protected  java.lang.String packageNameForImport(org.codehaus.groovy.ast.ImportNode importNode)
           
 void setApplyToFileNames(java.lang.String value)
           
 void setApplyToFilesMatching(java.lang.String value)
           
 void setDescription(java.lang.String value)
           
 void setDoNotApplyToFileNames(java.lang.String value)
           
 void setDoNotApplyToFilesMatching(java.lang.String value)
           
 void setEnabled(boolean value)
           
 void setMetaClass(groovy.lang.MetaClass mc)
           
abstract  void setName(java.lang.String name)
           
abstract  void setPriority(int priority)
           
 void setProperty(java.lang.String property, java.lang.Object value)
           
 void setViolationMessage(java.lang.String value)
           
protected  java.lang.Object sourceLineAndNumberForImport(SourceCode sourceCode, org.codehaus.groovy.ast.ImportNode importNode)
           
protected  java.lang.Object sourceLineAndNumberForImport(SourceCode sourceCode, java.lang.String className, java.lang.String alias)
           
 java.lang.String toString()
           
 void validate()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AbstractRule

public AbstractRule()
Method Detail

createViolation

protected Violation createViolation(java.lang.Integer lineNumber,
                                    java.lang.String sourceLine)

createViolation

protected Violation createViolation(java.lang.Integer lineNumber)

createViolation

protected Violation createViolation(SourceCode sourceCode,
                                    org.codehaus.groovy.ast.ASTNode node)

getMetaClass

public groovy.lang.MetaClass getMetaClass()
Specified by:
getMetaClass in interface groovy.lang.GroovyObject

setMetaClass

public void setMetaClass(groovy.lang.MetaClass mc)
Specified by:
setMetaClass in interface groovy.lang.GroovyObject

invokeMethod

public java.lang.Object invokeMethod(java.lang.String method,
                                     java.lang.Object arguments)
Specified by:
invokeMethod in interface groovy.lang.GroovyObject

getProperty

public java.lang.Object getProperty(java.lang.String property)
Specified by:
getProperty in interface groovy.lang.GroovyObject

setProperty

public void setProperty(java.lang.String property,
                        java.lang.Object value)
Specified by:
setProperty in interface groovy.lang.GroovyObject

getLOG

public static java.lang.Object getLOG()

getEnabled

public boolean getEnabled()

isEnabled

public boolean isEnabled()

setEnabled

public void setEnabled(boolean value)

getApplyToFilesMatching

public java.lang.String getApplyToFilesMatching()

setApplyToFilesMatching

public void setApplyToFilesMatching(java.lang.String value)

getDoNotApplyToFilesMatching

public java.lang.String getDoNotApplyToFilesMatching()

setDoNotApplyToFilesMatching

public void setDoNotApplyToFilesMatching(java.lang.String value)

getApplyToFileNames

public java.lang.String getApplyToFileNames()

setApplyToFileNames

public void setApplyToFileNames(java.lang.String value)

getDoNotApplyToFileNames

public java.lang.String getDoNotApplyToFileNames()

setDoNotApplyToFileNames

public void setDoNotApplyToFileNames(java.lang.String value)

getViolationMessage

public java.lang.String getViolationMessage()

setViolationMessage

public void setViolationMessage(java.lang.String value)

getDescription

public java.lang.String getDescription()

setDescription

public void setDescription(java.lang.String value)

getName

public abstract java.lang.String getName()
Specified by:
getName in interface Rule

setName

public abstract void setName(java.lang.String name)

getPriority

public abstract int getPriority()
Specified by:
getPriority in interface Rule

setPriority

public abstract void setPriority(int priority)

applyTo

public abstract void applyTo(SourceCode sourceCode,
                             java.util.List violations)

applyTo

public java.util.List applyTo(SourceCode sourceCode)
Specified by:
applyTo in interface Rule

isReady

public boolean isReady()

validate

public void validate()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

createViolation

protected Violation createViolation(java.lang.Integer lineNumber,
                                    java.lang.String sourceLine,
                                    java.lang.String message)

createViolationForImport

protected Violation createViolationForImport(SourceCode sourceCode,
                                             org.codehaus.groovy.ast.ImportNode importNode)

createViolationForImport

protected Violation createViolationForImport(SourceCode sourceCode,
                                             java.lang.String className,
                                             java.lang.String alias)

createViolation

protected Violation createViolation(SourceCode sourceCode,
                                    org.codehaus.groovy.ast.ASTNode node,
                                    java.lang.Object message)

getImportsSortedByLineNumber

protected java.util.List getImportsSortedByLineNumber(java.lang.Object sourceCode)

sourceLineAndNumberForImport

protected java.lang.Object sourceLineAndNumberForImport(SourceCode sourceCode,
                                                        java.lang.String className,
                                                        java.lang.String alias)

sourceLineAndNumberForImport

protected java.lang.Object sourceLineAndNumberForImport(SourceCode sourceCode,
                                                        org.codehaus.groovy.ast.ImportNode importNode)

packageNameForImport

protected java.lang.String packageNameForImport(org.codehaus.groovy.ast.ImportNode importNode)


Copyright © 2011. All Rights Reserved.