Java Code Examples for org.codehaus.groovy.control.customizers.ImportCustomizer#addStarImports()
The following examples show how to use
org.codehaus.groovy.control.customizers.ImportCustomizer#addStarImports() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GroovyScriptEvaluatorTests.java From spring-analysis-note with MIT License | 5 votes |
@Test public void testGroovyScriptWithImportCustomizer() { GroovyScriptEvaluator evaluator = new GroovyScriptEvaluator(); ImportCustomizer importCustomizer = new ImportCustomizer(); importCustomizer.addStarImports("org.springframework.util"); evaluator.setCompilationCustomizers(importCustomizer); Object result = evaluator.evaluate(new StaticScriptSource("return ResourceUtils.CLASSPATH_URL_PREFIX")); assertEquals("classpath:", result); }
Example 2
Source File: GroovyScriptEvaluatorTests.java From java-technology-stack with MIT License | 5 votes |
@Test public void testGroovyScriptWithImportCustomizer() { GroovyScriptEvaluator evaluator = new GroovyScriptEvaluator(); ImportCustomizer importCustomizer = new ImportCustomizer(); importCustomizer.addStarImports("org.springframework.util"); evaluator.setCompilationCustomizers(importCustomizer); Object result = evaluator.evaluate(new StaticScriptSource("return ResourceUtils.CLASSPATH_URL_PREFIX")); assertEquals("classpath:", result); }
Example 3
Source File: GroovyService.java From JuniperBot with GNU General Public License v3.0 | 5 votes |
@PostConstruct public void init() { ImportCustomizer importCustomizer = new ImportCustomizer(); importCustomizer.addStarImports("net.dv8tion.jda.api.entities"); configuration = new CompilerConfiguration(); configuration.addCompilationCustomizers(importCustomizer); sharedData = new Binding(); sharedData.setProperty("ctx", context); }
Example 4
Source File: BaseStreamCompilerAutoConfiguration.java From spring-cloud-cli with Apache License 2.0 | 5 votes |
@Override public void applyImports(ImportCustomizer imports) throws CompilationFailedException { this.integration.applyImports(imports); imports.addImports("org.springframework.boot.groovy.cloud.EnableBinding"); imports.addImport("IntegrationMessageSource", "org.springframework.integration.core.MessageSource"); imports.addStarImports("org.springframework.cloud.stream.annotation", "org.springframework.cloud.stream.messaging"); }
Example 5
Source File: GroovyClassLoaderFactory.java From beakerx with Apache License 2.0 | 5 votes |
public static void addImportPathToImportCustomizer(ImportCustomizer icz, ImportPath importLine) { if (importLine.asString().startsWith(STATIC_WORD_WITH_SPACE)) { String pureImport = importLine.asString() .replace(STATIC_WORD_WITH_SPACE, StringUtils.EMPTY) .replace(DOT_STAR_POSTFIX, StringUtils.EMPTY); if (importLine.asString().endsWith(DOT_STAR_POSTFIX)) { icz.addStaticStars(pureImport); } else { int index = pureImport.lastIndexOf('.'); if (index == -1) { return; } icz.addStaticImport(pureImport.substring(0, index), pureImport.substring(index + 1)); } } else { if (importLine.asString().endsWith(DOT_STAR_POSTFIX)) { icz.addStarImports(importLine.asString().replace(DOT_STAR_POSTFIX, StringUtils.EMPTY)); } else { icz.addImports(importLine.asString()); } } }
Example 6
Source File: ReadMavenPomStep.java From pipeline-utility-steps-plugin with MIT License | 4 votes |
@Override public void customizeImports(CpsFlowExecution context, ImportCustomizer ic) { ic.addStarImports(ORG_APACHE_MAVEN_MODEL); }
Example 7
Source File: ReadCSVStep.java From pipeline-utility-steps-plugin with MIT License | 4 votes |
@Override public void customizeImports(CpsFlowExecution context, ImportCustomizer ic) { ic.addStarImports(ORG_APACHE_COMMONS_CSV); }