Groovy Documentation

groovy.org.codenarc.util
[Groovy] Class ImportUtil

java.lang.Object
  groovy.org.codenarc.util.ImportUtil

class ImportUtil

Contains static utility methods and constants related to Import statements.

This is an internal class and its API is subject to change.

Authors:
Chris Mair


Method Summary
static List getImportsSortedByLineNumber(def sourceCode)

static List getNonStaticImportsSortedByLineNumber(def sourceCode)

static String packageNameForImport(org.codehaus.groovy.ast.ImportNode importNode)

Return the package name for the specified import statement or else an empty String

static Map sourceLineAndNumberForImport(SourceCode sourceCode, String className, String alias)

Return the source line and line number for the specified import class name and alias

static Map sourceLineAndNumberForImport(SourceCode sourceCode, org.codehaus.groovy.ast.ImportNode importNode)

Return the source line and line number for the specified import

static Map sourceLineAndNumberForNonStarImport(SourceCode sourceCode, org.codehaus.groovy.ast.ImportNode importNode)

static Map sourceLineAndNumberForStarImport(SourceCode sourceCode, org.codehaus.groovy.ast.ImportNode importNode)

Return the source line and line number for the specified import class name and alias

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

Method Detail

getImportsSortedByLineNumber

static List getImportsSortedByLineNumber(def sourceCode)


getNonStaticImportsSortedByLineNumber

static List getNonStaticImportsSortedByLineNumber(def sourceCode)


packageNameForImport

static String packageNameForImport(org.codehaus.groovy.ast.ImportNode importNode)
Return the package name for the specified import statement or else an empty String
Returns:
the name package being imported (i.e., the import minus the class name/spec) or an empty String if the import contains no package component
Parameters:
importNode - - the ImportNode for the import


sourceLineAndNumberForImport

static Map sourceLineAndNumberForImport(SourceCode sourceCode, String className, String alias)
Return the source line and line number for the specified import class name and alias
Returns:
an object that has 'sourceLine' and 'lineNumber' fields
Parameters:
sourceCode - - the SourceCode being processed
importNode - - the ImportNode representing the import


sourceLineAndNumberForImport

static Map sourceLineAndNumberForImport(SourceCode sourceCode, org.codehaus.groovy.ast.ImportNode importNode)
Return the source line and line number for the specified import
Returns:
an object that has 'sourceLine' and 'lineNumber' fields
Parameters:
sourceCode - - the SourceCode being processed
importNode - - the ImportNode representing the import


sourceLineAndNumberForNonStarImport

static Map sourceLineAndNumberForNonStarImport(SourceCode sourceCode, org.codehaus.groovy.ast.ImportNode importNode)


sourceLineAndNumberForStarImport

static Map sourceLineAndNumberForStarImport(SourceCode sourceCode, org.codehaus.groovy.ast.ImportNode importNode)
Return the source line and line number for the specified import class name and alias
Returns:
an object that has 'sourceLine' and 'lineNumber' fields
Parameters:
sourceCode - - the SourceCode being processed
importNode - - the ImportNode representing the import


 

Groovy Documentation