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

-     public class ImportNode
      extends AnnotatedNode

  Represents an import statement.

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `ImportNode​(java.lang.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, java.lang.String alias)` | An import of a single type, i.e. `import pack.Type` or `import pack.Type as Alias`
    `ImportNode​(ClassNode type, java.lang.String fieldName, java.lang.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

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `java.lang.String` | `getAlias()` |
    `java.lang.String` | `getClassName()` |
    `java.lang.String` | `getFieldName()` |
    `java.lang.String` | `getPackageName()` |
    `java.lang.String` | `getText()` |
    `ClassNode` | `getType()` |
    `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, hasNoRealSourcePosition, isSynthetic, setDeclaringClass, setHasNoRealSourcePosition, setSynthetic`

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

      `copyNodeMetaData, getColumnNumber, getLastColumnNumber, getLastLineNumber, getLineNumber, getMetaDataMap, getNodeMetaData, getNodeMetaData, putNodeMetaData, removeNodeMetaData, setColumnNumber, setLastColumnNumber, setLastLineNumber, setLineNumber, setNodeMetaData, setSourcePosition`

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

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

- - ### Constructor Detail

    - #### ImportNode

          public ImportNode​(ClassNode type,
                            java.lang.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​(java.lang.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,
                            java.lang.String fieldName,
                            java.lang.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 Detail

    - #### getText

          public java.lang.String getText()

      Overrides:
        `getText` in class `ASTNode`
      Returns:
        the text display of this import

    - #### isStar

          public boolean isStar()

    - #### isStatic

          public boolean isStatic()

    - #### getAlias

          public java.lang.String getAlias()

    - #### getClassName

          public java.lang.String getClassName()

    - #### getFieldName

          public java.lang.String getFieldName()

    - #### getPackageName

          public java.lang.String getPackageName()

    - #### getType

          public ClassNode getType()

    - #### setType

          public void setType​(ClassNode type)

    - #### visit

          public void visit​(GroovyCodeVisitor visitor)

      Overrides:
        `visit` in class `ASTNode`