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)
oraddImports(String...)
- star imports thanks to
addStarImport(String)
oraddStarImports(String...)
- static imports thanks to
addStaticImport(String, String)
oraddStaticImport(String, String, String)
- static star imports thanks to
addStaticStar(String)
oraddStaticStars(String...)
- Since:
- 1.8.0
- standard imports thanks to
-
-
Constructor Summary
Constructors Constructor Description ImportCustomizer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ImportCustomizer
addImport(String alias, String className)
ImportCustomizer
addImports(String... imports)
ImportCustomizer
addStarImports(String... packageNames)
ImportCustomizer
addStaticImport(String className, String fieldName)
ImportCustomizer
addStaticImport(String alias, String className, String fieldName)
ImportCustomizer
addStaticStars(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
-
-
-
-
Method Detail
-
call
public void call(SourceUnit source, GeneratorContext context, ClassNode classNode) throws CompilationFailedException
- Specified by:
call
in classCompilationUnit.PrimaryClassNodeOperation
- Throws:
CompilationFailedException
-
addImport
public ImportCustomizer addImport(String alias, String className)
-
addStaticImport
public ImportCustomizer addStaticImport(String className, String fieldName)
-
addStaticStars
public ImportCustomizer addStaticStars(String... classNames)
-
addStaticImport
public ImportCustomizer addStaticImport(String alias, String className, String fieldName)
-
addImports
public ImportCustomizer addImports(String... imports)
-
addStarImports
public ImportCustomizer addStarImports(String... packageNames)
-
-