Groovy Documentation

## org.codehaus.groovy.ast
[Java] Class ImportNode

    java.lang.Object
      org.codehaus.groovy.ast.ASTNode
          org.codehaus.groovy.ast.AnnotatedNode
              org.codehaus.groovy.ast.ImportNode

All Implemented Interfaces:
  org.objectweb.asm.Opcodes

    public class ImportNode
    extends AnnotatedNode

Represents an import statement of a single class

Authors:
  Jochen Theodorou
  Paul King
  James Strachan

Constructor Summary
`ImportNode(ClassNode type, java.lang.String alias)` Represent an import of an entire package, i.e.
`ImportNode(java.lang.String packageName)` Represent an import of an entire package, i.e.
`ImportNode(ClassNode type)` Represent a static import of a Class, i.e.
`ImportNode(ClassNode type, java.lang.String fieldName, java.lang.String alias)` Represent a static import of a field or method, i.e.

Method Summary
`java.lang.String` | `getAlias()`
`java.lang.String` | `getClassName()`
`java.lang.String` | `getFieldName()`
`java.lang.String` | `getPackageName()`
`java.lang.String` | `getText()` @return the text display of this import
`ClassNode` | `getType()`
`boolean` | `isStar()`
`boolean` | `isStatic()`
`void` | `visit(GroovyCodeVisitor visitor)`

Methods inherited from class AnnotatedNode
addAnnotation, addAnnotations, getAnnotations, getAnnotations, getDeclaringClass, hasNoRealSourcePosition, isSynthetic, setDeclaringClass, setHasNoRealSourcePosition, setSynthetic

Methods inherited from class ASTNode
copyNodeMetaData, getColumnNumber, getLastColumnNumber, getLastLineNumber, getLineNumber, getNodeMetaData, getText, putNodeMetaData, removeNodeMetaData, setColumnNumber, setLastColumnNumber, setLastLineNumber, setLineNumber, setNodeMetaData, setSourcePosition, visit

Methods inherited from class java.lang.Object
java.lang.Object#wait(long), java.lang.Object#wait(long, int), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll()

Constructor Detail

### ImportNode

    public ImportNode(ClassNode type, java.lang.String alias)

  Represent an import of an entire package, i.e. import package.Classname
  Parameters:
    `type` - the referenced class
    `alias` - optional alias

### ImportNode

    public ImportNode(java.lang.String packageName)

  Represent an import of an entire package, i.e. import package.*
  Parameters:
    `packageName` - the name of the package

### ImportNode

    public ImportNode(ClassNode type)

  Represent a static import of a Class, i.e. import static package.Classname.*
  Parameters:
    `type` - the referenced class

### ImportNode

    public ImportNode(ClassNode type, java.lang.String fieldName, java.lang.String alias)

  Represent a static import of a field or method, i.e. import static package.Classname.name
  Parameters:
    `type` - the referenced class
    `fieldName` - the field name
    `alias` - optional alias

Method Detail

### getAlias

    public java.lang.String getAlias()

### getClassName

    public java.lang.String getClassName()

### getFieldName

    public java.lang.String getFieldName()

### getPackageName

    public java.lang.String getPackageName()

### getText

    public java.lang.String getText()

  Returns:
    the text display of this import

### getType

    public ClassNode getType()

### isStar

    public boolean isStar()

### isStatic

    public boolean isStatic()

### visit

    public void visit(GroovyCodeVisitor visitor)

Groovy Documentation