Package org.codehaus.groovy.ast

# Class ImportNode

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

All Implemented Interfaces:
  `GroovydocHolder<AnnotatedNode>`, `NodeMetaDataHandler`

public class ImportNode extends AnnotatedNode
Represents an import statement.

- ## Field Summary

  ### Fields inherited from interface groovy.lang.groovydoc.GroovydocHolder

  `DOC_COMMENT`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ImportNode(String packageName)`
  An import of all types in a package, i.e. `import pack.*`
  `ImportNode(ClassNode type)`
  An import of all static members of a type, i.e. `import static pack.Type.*`
  `ImportNode(ClassNode type, String alias)`
  An import of a single type, i.e. `import pack.Type` or `import pack.Type as Alias`
  `ImportNode(ClassNode type, String fieldName, String alias)`
  An import of a static field or method of a type, i.e. `import static pack.Type.name` or `import static pack.Type.name as alias`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `equals(Object o)`
  `String`
  `getAlias()`
  `String`
  `getClassName()`
  `String`
  `getFieldName()`
  `String`
  `getPackageName()`
  `String`
  `getText()`
  `ClassNode`
  `getType()`
  `int`
  `hashCode()`
  `boolean`
  `isStar()`
  `boolean`
  `isStatic()`
  `void`
  `setType(ClassNode type)`
  `void`
  `visit(GroovyCodeVisitor visitor)`

  ### Methods inherited from class org.codehaus.groovy.ast.AnnotatedNode

  `addAnnotation, addAnnotations, getAnnotations, getAnnotations, getDeclaringClass, getGroovydoc, getInstance, hasNoRealSourcePosition, isSynthetic, setDeclaringClass, setHasNoRealSourcePosition, setSynthetic`

  ### Methods inherited from class org.codehaus.groovy.ast.ASTNode

  `copyNodeMetaData, getColumnNumber, getLastColumnNumber, getLastLineNumber, getLineNumber, getMetaDataMap, setColumnNumber, setLastColumnNumber, setLastLineNumber, setLineNumber, setMetaDataMap, setSourcePosition`

  ### Methods inherited from class java.lang.Object

  `clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

  ### Methods inherited from interface org.codehaus.groovy.ast.NodeMetaDataHandler

  `copyNodeMetaData, getNodeMetaData, getNodeMetaData, getNodeMetaData, putNodeMetaData, removeNodeMetaData, setNodeMetaData`

- ## Constructor Details

  - ### ImportNode

    public ImportNode(ClassNode type, String alias)
    An import of a single type, i.e. `import pack.Type` or `import pack.Type as Alias`
    Parameters:
      `type` - the type reference
      `alias` - optional alias

  - ### ImportNode

    public ImportNode(String packageName)
    An import of all types in a package, i.e. `import pack.*`
    Parameters:
      `packageName` - the name of the package

  - ### ImportNode

    public ImportNode(ClassNode type)
    An import of all static members of a type, i.e. `import static pack.Type.*`
    Parameters:
      `type` - the type reference

  - ### ImportNode

    public ImportNode(ClassNode type, String fieldName, String alias)
    An import of a static field or method of a type, i.e. `import static pack.Type.name` or `import static pack.Type.name as alias`
    Parameters:
      `type` - the type reference
      `fieldName` - the field name
      `alias` - optional alias

- ## Method Details

  - ### getText

    public String getText()
    Overrides:
      `getText` in class `ASTNode`
    Returns:
      the text display of this import

  - ### isStar

    public boolean isStar()

  - ### isStatic

    public boolean isStatic()

  - ### getAlias

    public String getAlias()

  - ### getClassName

    public String getClassName()

  - ### getFieldName

    public String getFieldName()

  - ### getPackageName

    public String getPackageName()

  - ### getType

    public ClassNode getType()

  - ### setType

    public void setType(ClassNode type)

  - ### equals

    public boolean equals(Object o)
    Overrides:
      `equals` in class `Object`

  - ### hashCode

    public int hashCode()
    Overrides:
      `hashCode` in class `Object`

  - ### visit

    public void visit(GroovyCodeVisitor visitor)
    Overrides:
      `visit` in class `ASTNode`