org.codehaus.groovy.control.customizers

## Class ImportCustomizer

- java.lang.Object
- - org.codehaus.groovy.control.CompilationUnit.PrimaryClassNodeOperation
  - - org.codehaus.groovy.control.customizers.CompilationCustomizer
    - - org.codehaus.groovy.control.customizers.ImportCustomizer

-     public class ImportCustomizer
      extends CompilationCustomizer

  This compilation customizer allows addiing various types of imports to the compilation unit. Supports adding :
  - standard imports thanks to `addImport(String)`, `addImport(String, String)` or `addImports(String...)`
  - star imports thanks to `addStarImport(String)` or `addStarImports(String...)`
  - static imports thanks to `addStaticImport(String, String)` or `addStaticImport(String, String, String)`
  - static star imports thanks to `addStaticStar(String)` or `addStaticStars(String...)`
  Since:
    1.8.0
  Author:
    Cedric Champeau

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ImportCustomizer()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `ImportCustomizer` | `addImport(java.lang.String alias, java.lang.String className)`
    `ImportCustomizer` | `addImports(java.lang.String... imports)`
    `ImportCustomizer` | `addStarImports(java.lang.String... packageNames)`
    `ImportCustomizer` | `addStaticImport(java.lang.String className, java.lang.String fieldName)`
    `ImportCustomizer` | `addStaticImport(java.lang.String alias, java.lang.String className, java.lang.String fieldName)`
    `ImportCustomizer` | `addStaticStars(java.lang.String... classNames)`
    `void` | `call(SourceUnit source, GeneratorContext context, ClassNode classNode)`

    - ### Methods inherited from class org.codehaus.groovy.control.customizers.CompilationCustomizer

      `getPhase`

    - ### Methods inherited from class org.codehaus.groovy.control.CompilationUnit.PrimaryClassNodeOperation

      `needSortedInput`

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

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

- - ### Constructor Detail

    - #### ImportCustomizer

          public ImportCustomizer()

  - ### Method Detail

    - #### call

          public void call(SourceUnit source,
                           GeneratorContext context,
                           ClassNode classNode)
                    throws CompilationFailedException

      Specified by:
        `call` in class `CompilationUnit.PrimaryClassNodeOperation`
      Throws:
        `CompilationFailedException`

    - #### addImport

          public ImportCustomizer addImport(java.lang.String alias,
                                            java.lang.String className)

    - #### addStaticImport

          public ImportCustomizer addStaticImport(java.lang.String className,
                                                  java.lang.String fieldName)

    - #### addStaticStars

          public ImportCustomizer addStaticStars(java.lang.String... classNames)

    - #### addStaticImport

          public ImportCustomizer addStaticImport(java.lang.String alias,
                                                  java.lang.String className,
                                                  java.lang.String fieldName)

    - #### addImports

          public ImportCustomizer addImports(java.lang.String... imports)

    - #### addStarImports

          public ImportCustomizer addStarImports(java.lang.String... packageNames)