本文整理匯總了Java中org.codehaus.groovy.control.CompilerConfiguration.getClasspath方法的典型用法代碼示例。如果您正苦於以下問題:Java CompilerConfiguration.getClasspath方法的具體用法?Java CompilerConfiguration.getClasspath怎麽用?Java CompilerConfiguration.getClasspath使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.codehaus.groovy.control.CompilerConfiguration
的用法示例。
在下文中一共展示了CompilerConfiguration.getClasspath方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: GroovyCodeBlockCompiler
import org.codehaus.groovy.control.CompilerConfiguration; //導入方法依賴的package包/類
private GroovyCodeBlockCompiler() {
CompilerConfiguration conf = new CompilerConfiguration(CompilerConfiguration.DEFAULT);
ImportCustomizer imports = new ImportCustomizer();
imports.addStarImports("org.voltdb");
imports.addImports(
"org.voltdb.groovy.TableBuilder",
"org.voltdb.groovy.Tuplerator",
"org.voltdb.VoltProcedure.VoltAbortException"
);
imports.addStaticStars("org.voltdb.VoltProcedure","org.voltdb.VoltType");
conf.addCompilationCustomizers(imports);
// conf.getOptimizationOptions().put("int", false);
// conf.getOptimizationOptions().put("indy", true);
conf.setScriptBaseClass(DelegatingScript.class.getName());
File groovyOut = createGroovyOutDirectory();
List<String> classPath = conf.getClasspath();
classPath.add(groovyOut.getAbsolutePath());
conf.setClasspathList(classPath);
conf.setTargetDirectory(groovyOut);
gcl = new GroovyClassLoader(Thread.currentThread().getContextClassLoader(), conf);
}
示例2: GroovyClassLoader
import org.codehaus.groovy.control.CompilerConfiguration; //導入方法依賴的package包/類
/**
* creates a GroovyClassLoader.
*
* @param parent the parent class loader
* @param config the compiler configuration
* @param useConfigurationClasspath determines if the configurations classpath should be added
*/
public GroovyClassLoader(ClassLoader parent, CompilerConfiguration config, boolean useConfigurationClasspath) {
super(EMPTY_URL_ARRAY, parent);
if (config == null) config = CompilerConfiguration.DEFAULT;
this.config = config;
if (useConfigurationClasspath) {
for (String path : config.getClasspath()) {
this.addClasspath(path);
}
}
initSourceEncoding(config);
}