Groovy Documentation

groovy.org.codenarc.source
[Groovy] Class AbstractSourceCode

java.lang.Object
  groovy.org.codenarc.source.AbstractSourceCode
All Implemented Interfaces:
SourceCode

@SuppressWarnings('AbstractClassWithoutAbstractMethod')
abstract class AbstractSourceCode

Abstract superclass for SourceCode implementations

Authors:
Chris Mair
Hamlet D'Arcy


Property Summary
static def LOG

static def SEPARATOR_PROP

SuppressionAnalyzer suppressionAnalyzer

 
Method Summary
org.codehaus.groovy.ast.ModuleNode getAst()

Return the Groovy AST (Abstract Syntax Tree) for this source file

int getAstCompilerPhase()

@return compiler phase (as in org.codehaus.groovy.control.Phases) up to which the AST will be processed

int getLineNumberForCharacterIndex(int charIndex)

Return the line index for the line containing the character at the specified index within the source code.

List getLines()

@return the List of lines of the source code (with line terminators removed)

Map getMethodCallExpressions()

boolean isValid()

Return true if and only if the source code can be successfully compiled

String line(int lineNumber)

Get the trimmed line at the specified index

protected String normalizePath(String path)

Return the normalized value of the specified path.

protected void setSuppressionAnalyzer(SuppressionAnalyzer suppressionAnalyzer)

Setter exists to avoid circular dependency.

 
Methods inherited from class Object
wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll
 

Property Detail

LOG

static final def LOG


SEPARATOR_PROP

static final def SEPARATOR_PROP


suppressionAnalyzer

SuppressionAnalyzer suppressionAnalyzer


 
Method Detail

getAst

org.codehaus.groovy.ast.ModuleNode getAst()
Return the Groovy AST (Abstract Syntax Tree) for this source file
Returns:
the ModuleNode representing the AST for this source file


getAstCompilerPhase

@SuppressWarnings('GetterMethodCouldBeProperty')
int getAstCompilerPhase()
Returns:
compiler phase (as in org.codehaus.groovy.control.Phases) up to which the AST will be processed


getLineNumberForCharacterIndex

int getLineNumberForCharacterIndex(int charIndex)
Return the line index for the line containing the character at the specified index within the source code.
Returns:
the line number (one-based) containing the specified character; Return -1 if charIndex is not valid.
Parameters:
charIndex - - the index of the character within the source code (zero-based)


getLines

List getLines()
Returns:
the List of lines of the source code (with line terminators removed)


getMethodCallExpressions

Map getMethodCallExpressions()


isValid

boolean isValid()
Return true if and only if the source code can be successfully compiled
Returns:
true only if the source code is valid


line

String line(int lineNumber)
Get the trimmed line at the specified index
Returns:
the trimmed line at the specified index, or null if lineNumber is not valid
Parameters:
lineNumber - - the zero-based line number; may be negative


normalizePath

protected String normalizePath(String path)
Return the normalized value of the specified path. Convert file separator chars to standard '/'.
Returns:
the normalized value
Parameters:
path - - the path to normalize


setSuppressionAnalyzer

protected void setSuppressionAnalyzer(SuppressionAnalyzer suppressionAnalyzer)
Setter exists to avoid circular dependency.
Parameters:
suppressionAnalyzer - suppression analyzer


 

Groovy Documentation