当前位置: 首页>>代码示例>>Java>>正文


Java ImportCustomizer.addStaticStars方法代码示例

本文整理汇总了Java中org.codehaus.groovy.control.customizers.ImportCustomizer.addStaticStars方法的典型用法代码示例。如果您正苦于以下问题:Java ImportCustomizer.addStaticStars方法的具体用法?Java ImportCustomizer.addStaticStars怎么用?Java ImportCustomizer.addStaticStars使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.codehaus.groovy.control.customizers.ImportCustomizer的用法示例。


在下文中一共展示了ImportCustomizer.addStaticStars方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: applyConfigurationScript

import org.codehaus.groovy.control.customizers.ImportCustomizer; //导入方法依赖的package包/类
private void applyConfigurationScript(File configScript, CompilerConfiguration configuration) {
    VersionNumber version = parseGroovyVersion();
    if (version.compareTo(VersionNumber.parse("2.1")) < 0) {
        throw new GradleException("Using a Groovy compiler configuration script requires Groovy 2.1+ but found Groovy " + version + "");
    }
    Binding binding = new Binding();
    binding.setVariable("configuration", configuration);

    CompilerConfiguration configuratorConfig = new CompilerConfiguration();
    ImportCustomizer customizer = new ImportCustomizer();
    customizer.addStaticStars("org.codehaus.groovy.control.customizers.builder.CompilerCustomizationBuilder");
    configuratorConfig.addCompilationCustomizers(customizer);

    GroovyShell shell = new GroovyShell(binding, configuratorConfig);
    try {
        shell.evaluate(configScript);
    } catch (Exception e) {
        throw new GradleException("Could not execute Groovy compiler configuration script: " + configScript.getAbsolutePath(), e);
    }
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:21,代码来源:ApiGroovyCompiler.java

示例2: getGroovyShell

import org.codehaus.groovy.control.customizers.ImportCustomizer; //导入方法依赖的package包/类
private GroovyShell getGroovyShell() {
  if (this.groovySh == null) {
    // add some default imports to the script
    ImportCustomizer defaultImports = new ImportCustomizer();
    defaultImports
        .addStarImports("fr.ign.cogit.geoxygene.appli.render.primitive");
    defaultImports
        .addStarImports("fr.ign.cogit.geoxygene.appli.render.operator");
    defaultImports.addStarImports("fr.ign.cogit.geoxygene.appli.render.gl");
    defaultImports.addStarImports("fr.ign.cogit.geoxygene.appli.render");
    defaultImports.addStarImports("fr.ign.cogit.geoxygene.function");
    defaultImports.addStaticStars("org.lwjgl.opengl.GL11");
    defaultImports.addStaticStars("java.lang.Math");
    defaultImports.addStarImports("javax.vecmath");
    defaultImports.addStarImports("java.awt");
    final CompilerConfiguration config = new CompilerConfiguration();
    config.addCompilationCustomizers(defaultImports);
    final Binding binding = this.getBinding();

    this.groovySh = new GroovyShell(binding, config);
  }
  return this.groovySh;
}
 
开发者ID:IGNF,项目名称:geoxygene,代码行数:24,代码来源:ScriptingPrimitiveRenderer.java

示例3: applyConfigurationScript

import org.codehaus.groovy.control.customizers.ImportCustomizer; //导入方法依赖的package包/类
private static void applyConfigurationScript(File configScript, CompilerConfiguration configuration) {
  Binding binding = new Binding();
  binding.setVariable("configuration", configuration);

  CompilerConfiguration configuratorConfig = new CompilerConfiguration();
  ImportCustomizer customizer = new ImportCustomizer();
  customizer.addStaticStars("org.codehaus.groovy.control.customizers.builder.CompilerCustomizationBuilder");
  configuratorConfig.addCompilationCustomizers(customizer);

  try {
    new GroovyShell(binding, configuratorConfig).evaluate(configScript);
  }
  catch (Exception e) {
    e.printStackTrace();
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:DependentGroovycRunner.java

示例4: configureCompiler

import org.codehaus.groovy.control.customizers.ImportCustomizer; //导入方法依赖的package包/类
private void configureCompiler() {
    if (scriptBaseClass!=null) {
        configuration.setScriptBaseClass(scriptBaseClass);
    }
    if (indy) {
        configuration.getOptimizationOptions().put("indy", Boolean.TRUE);
        configuration.getOptimizationOptions().put("int", Boolean.FALSE);
    }
    if (configscript!=null) {
        Binding binding = new Binding();
        binding.setVariable("configuration", configuration);

        CompilerConfiguration configuratorConfig = new CompilerConfiguration();
        ImportCustomizer customizer = new ImportCustomizer();
        customizer.addStaticStars("org.codehaus.groovy.control.customizers.builder.CompilerCustomizationBuilder");
        configuratorConfig.addCompilationCustomizers(customizer);

        GroovyShell shell = new GroovyShell(binding, configuratorConfig);
        File confSrc = new File(configscript);
        try {
            shell.evaluate(confSrc);
        } catch (IOException e) {
            throw new BuildException("Unable to configure compiler using configuration file: "+confSrc, e);
        }
    }
}
 
开发者ID:apache,项目名称:groovy,代码行数:27,代码来源:Groovy.java

示例5: processStaticImports

import org.codehaus.groovy.control.customizers.ImportCustomizer; //导入方法依赖的package包/类
protected static void processStaticImports(final ImportCustomizer ic, final Set<String> staticImports) {
    for (final String staticImport : staticImports) {
        if (staticImport.endsWith(DOT_STAR)) {
            ic.addStaticStars(staticImport.replace(DOT_STAR, EMPTY_STRING));
        } else {
            final int place = staticImport.lastIndexOf(PERIOD);
            ic.addStaticImport(staticImport.substring(0, place), staticImport.substring(place + 1));
        }
    }
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:11,代码来源:AbstractImportCustomizerProvider.java

示例6: configureCompiler

import org.codehaus.groovy.control.customizers.ImportCustomizer; //导入方法依赖的package包/类
@Override
public void configureCompiler(Object compiler) throws AppException {
    CompilerConfiguration cc = (CompilerConfiguration) compiler;
    ImportCustomizer imports = new ImportCustomizer();
    imports.addStaticStars("com.anrisoftware.sscontrol.types.external.BindingAddress");
    cc.addCompilationCustomizers(imports);
}
 
开发者ID:devent,项目名称:robobee-osgi,代码行数:8,代码来源:DatabasePreScriptImpl.java

示例7: GroovyCodeBlockCompiler

import org.codehaus.groovy.control.customizers.ImportCustomizer; //导入方法依赖的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);
    }
 
开发者ID:anhnv-3991,项目名称:VoltDB,代码行数:29,代码来源:GroovyCodeBlockCompiler.java

示例8: processConfigScripts

import org.codehaus.groovy.control.customizers.ImportCustomizer; //导入方法依赖的package包/类
public static void processConfigScripts(List<String> scripts, CompilerConfiguration conf) throws IOException {
    if (scripts.isEmpty()) return;
    Binding binding = new Binding();
    binding.setVariable("configuration", conf);
    CompilerConfiguration configuratorConfig = new CompilerConfiguration();
    ImportCustomizer customizer = new ImportCustomizer();
    customizer.addStaticStars("org.codehaus.groovy.control.customizers.builder.CompilerCustomizationBuilder");
    configuratorConfig.addCompilationCustomizers(customizer);
    GroovyShell shell = new GroovyShell(binding, configuratorConfig);
    for (String script : scripts) {
        shell.evaluate(new File(script));
    }
}
 
开发者ID:apache,项目名称:groovy,代码行数:14,代码来源:GroovyMain.java

示例9: getCompilerConfiguration

import org.codehaus.groovy.control.customizers.ImportCustomizer; //导入方法依赖的package包/类
/**
 * Get default compiler configuration for {@link GroovyShell}.
 */
public CompilerConfiguration getCompilerConfiguration() {
    CompilerConfiguration cc = new CompilerConfiguration();
    ImportCustomizer imports = new ImportCustomizer();
    for (String starImport: STAR_IMPORTS) {
        imports.addStarImports(starImport);
    }
    for (String staticStar: STATIC_IMPORTS) {
        imports.addStaticStars(staticStar);
    }
    cc.addCompilationCustomizers(imports);
    return cc;
}
 
开发者ID:olivergondza,项目名称:dumpling,代码行数:16,代码来源:GroovyInterpretterConfig.java

示例10: getImports

import org.codehaus.groovy.control.customizers.ImportCustomizer; //导入方法依赖的package包/类
private ImportCustomizer getImports() {
    ImportCustomizer result = new ImportCustomizer();
    try {
        if (Class.forName("sorcer.modeling.vfe.Var") != null) {
            result.addStarImports(modelingImports);
            result.addStaticStars(modelingStaticImports);
        }
    } catch (ClassNotFoundException e) {
        result.addStarImports(imports);
        result.addStaticStars(staticImports);
    }
    return result;
}
 
开发者ID:mwsobol,项目名称:SORCER,代码行数:14,代码来源:ScripterThread.java

示例11: addImportPathToImportCustomizer

import org.codehaus.groovy.control.customizers.ImportCustomizer; //导入方法依赖的package包/类
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());
    }

  }
}
 
开发者ID:twosigma,项目名称:beakerx,代码行数:28,代码来源:GroovyClassLoaderFactory.java

示例12: createGroovyShell

import org.codehaus.groovy.control.customizers.ImportCustomizer; //导入方法依赖的package包/类
public GroovyShell createGroovyShell(Exchange exchange) {
    ImportCustomizer importCustomizer = new ImportCustomizer();
    importCustomizer.addStaticStars("org.wildfly.camel.test.script.subA.CustomUtils");
    CompilerConfiguration configuration = new CompilerConfiguration();
    configuration.addCompilationCustomizers(importCustomizer);
    ClassLoader classLoader = exchange.getContext().getApplicationContextClassLoader();
    return new GroovyShell(classLoader, configuration);
}
 
开发者ID:wildfly-extras,项目名称:wildfly-camel,代码行数:9,代码来源:CustomGroovyShellFactory.java

示例13: newEvaluator

import org.codehaus.groovy.control.customizers.ImportCustomizer; //导入方法依赖的package包/类
protected GroovyClassLoader newEvaluator() throws MalformedURLException {

    try {
      Class.forName("org.codehaus.groovy.control.customizers.ImportCustomizer");
    } catch (ClassNotFoundException e1) {
      String gjp = System.getenv(GROOVY_JAR_PATH);
      String errorMsg = null;
      if (gjp != null && !gjp.isEmpty()) {
        errorMsg = "Groovy libary not found, GROOVY_JAR_PATH = " + gjp;
      } else {
        errorMsg = "Default groovy libary not found. No GROOVY_JAR_PATH variable set.";
      }
      throw new GroovyNotFoundException(errorMsg);
    }

    ImportCustomizer icz = new ImportCustomizer();

    if (!imports.isEmpty()) {
      for (String importLine : imports) {
        if (importLine.startsWith(STATIC_WORD_WITH_SPACE)) {

          String pureImport = importLine
                  .replace(STATIC_WORD_WITH_SPACE, StringUtils.EMPTY)
                  .replace(DOT_STAR_POSTFIX, StringUtils.EMPTY);

          if (importLine.endsWith(DOT_STAR_POSTFIX)) {
            icz.addStaticStars(pureImport);
          } else {
            int index = pureImport.lastIndexOf('.');
            if (index == -1) {
              continue;
            }
            icz.addStaticImport(pureImport.substring(0, index), pureImport.substring(index + 1));
          }

        } else {

          if (importLine.endsWith(DOT_STAR_POSTFIX)) {
            icz.addStarImports(importLine.replace(DOT_STAR_POSTFIX, StringUtils.EMPTY));
          } else {
            icz.addImports(importLine);
          }

        }
      }
    }
    CompilerConfiguration config = new CompilerConfiguration().addCompilationCustomizers(icz);

    String acloader_cp = "";
    for (int i = 0; i < classPath.size(); i++) {
      acloader_cp += classPath.get(i);
      acloader_cp += File.pathSeparatorChar;
    }
    acloader_cp += outDir;

    config.setClasspath(acloader_cp);

    compilerConfiguration = config;

    scriptBinding = new Binding();
    return new GroovyClassLoader(newClassLoader(), compilerConfiguration);
  }
 
开发者ID:twosigma,项目名称:beaker-notebook-archive,代码行数:63,代码来源:GroovyEvaluator.java

示例14: createLeaveManagement

import org.codehaus.groovy.control.customizers.ImportCustomizer; //导入方法依赖的package包/类
@Transactional
public void createLeaveManagement(Employee employee) throws AxelorException{  
	
	batch = batchRepo.find(batch.getId());
	int count = 0;
	String eval = null;
	LeaveLine leaveLine = null;
	BigDecimal quantity = BigDecimal.ZERO;
	
	if (!employee.getLeaveLineList().isEmpty()){
		for (LeaveLine line : employee.getLeaveLineList()) {
			
			if(line.getLeaveReason().equals(batch.getHrBatch().getLeaveReason())){
				count ++;
				leaveLine = line;
			}
		}
	}
	
	if (count == 0){ throw new AxelorException(String.format(I18n.get(IExceptionMessage.EMPLOYEE_NO_LEAVE_MANAGEMENT), employee.getName(), batch.getHrBatch().getLeaveReason().getLeaveReason() ), IException.NO_VALUE ); }
	if(count > 1 ){ throw new AxelorException(String.format(I18n.get(IExceptionMessage.EMPLOYEE_DOUBLE_LEAVE_MANAGEMENT), employee.getName(), batch.getHrBatch().getLeaveReason().getLeaveReason() ), IException.CONFIGURATION_ERROR ); }
	
	if (count == 1){
		
		for (LeaveManagementBatchRule rule : Beans.get(HRConfigRepository.class).all().filter("self.company.id = ?1", batch.getHrBatch().getCompany().getId()).fetchOne().getLeaveManagementBatchRuleList() ) {
			
			if (rule.getExecutiveStatusSelect() == employee.getMainEmploymentContract().getExecutiveStatusSelect()){
				maker.setContext(employee, "Employee");
				String formula = rule.getFormula();
				formula = formula.replace(hrConfig.getSeniorityVariableName(), String.valueOf( Beans.get(EmployeeService.class).getLengthOfService(employee, batch.getHrBatch().getReferentialDate()) ) );
				formula = formula.replace(hrConfig.getAgeVariableName(), String.valueOf( Beans.get(EmployeeService.class).getAge(employee, batch.getHrBatch().getReferentialDate()) ) );
				maker.setTemplate(formula);
				eval = maker.make();
				CompilerConfiguration conf = new CompilerConfiguration();
				ImportCustomizer customizer = new ImportCustomizer();
				customizer.addStaticStars("java.lang.Math");                        
				conf.addCompilationCustomizers(customizer);
				Binding binding = new Binding();                                 
				GroovyShell shell = new GroovyShell(binding,conf);
				if (shell.evaluate(eval).toString().equals("true")){ quantity = rule.getLeaveDayNumber(); break; }
				
			}
		}
		if (quantity.compareTo(BigDecimal.ZERO) == 0){
			//If the quantity equals 0, no need to create a leaveManagement and to update the employee, since we won't give them any leaves
			incrementDone();
			return;
		}
		LeaveManagement leaveManagement = leaveManagementService.createLeaveManagement(leaveLine, AuthUtils.getUser(), batch.getHrBatch().getComments(), null, batch.getHrBatch().getStartDate(), batch.getHrBatch().getEndDate(), quantity);
		leaveLine.setQuantity(leaveLine.getQuantity().add(quantity));
		leaveLine.setTotalQuantity(leaveLine.getTotalQuantity().add(quantity));
		leaveManagementRepository.save(leaveManagement);
		leaveLineRepository.save(leaveLine);
		updateEmployee(employee);
	}
	
}
 
开发者ID:axelor,项目名称:axelor-business-suite,代码行数:58,代码来源:BatchSeniorityLeaveManagement.java


注:本文中的org.codehaus.groovy.control.customizers.ImportCustomizer.addStaticStars方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。