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


Java ExpressionEvaluator.evaluate方法代码示例

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


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

示例1: addProjectDependenciesToClassRealm

import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluator; //导入方法依赖的package包/类
private void addProjectDependenciesToClassRealm(ExpressionEvaluator expressionEvaluator, ClassRealm realm)
        throws ComponentConfigurationException {
    List<String> runtimeClasspathElements;
    try {
        // noinspection unchecked
        runtimeClasspathElements = (List<String>) expressionEvaluator
                .evaluate("${project.runtimeClasspathElements}");
    } catch (ExpressionEvaluationException e) {
        throw new ComponentConfigurationException(
                "There was a problem evaluating: ${project.runtimeClasspathElements}", e);
    }

    // Add the project dependencies to the ClassRealm
    final URL[] urls = buildUrls(runtimeClasspathElements);
    for (URL url : urls) {
        realm.addURL(url);
    }
}
 
开发者ID:protostuff,项目名称:protostuff-compiler,代码行数:19,代码来源:IncludeProjectDependenciesComponentConfigurator.java

示例2: buildAritfactDependencies

import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluator; //导入方法依赖的package包/类
private Collection<URL> buildAritfactDependencies(ExpressionEvaluator expressionEvaluator)
    throws ComponentConfigurationException
{
  MavenProject project;
  try
  {
    project = (MavenProject) expressionEvaluator.evaluate("${project}");
  }
  catch (ExpressionEvaluationException e1)
  {
    throw new ComponentConfigurationException("There was a problem evaluating: ${project}", e1);
  }
  Collection<URL> urls = new ArrayList<URL>();
  for (Object a : project.getArtifacts())
  {
    try
    {
      urls.add(((Artifact) a).getFile().toURI().toURL());
    }
    catch (MalformedURLException e)
    {
      throw new ComponentConfigurationException("Unable to resolve artifact dependency: " + a, e);
    }
  }
  return urls;
}
 
开发者ID:iisi-nj,项目名称:GemFireLite,代码行数:27,代码来源:DomainMojoConfigurator.java

示例3: buildAritfactDependencies

import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluator; //导入方法依赖的package包/类
private Collection<URL> buildAritfactDependencies(ExpressionEvaluator expressionEvaluator) throws ComponentConfigurationException {
    MavenProject project;
    try {
        project = (MavenProject) expressionEvaluator.evaluate("${project}");
    } catch (ExpressionEvaluationException e1) {
        throw new ComponentConfigurationException("There was a problem evaluating: ${project}", e1);
    }
    Collection<URL> urls = new ArrayList<URL>();
    for (Object a : project.getArtifacts()) {
        try {
            urls.add(((Artifact) a).getFile().toURI().toURL());
        } catch (MalformedURLException e) {
            throw new ComponentConfigurationException("Unable to resolve artifact dependency: " + a, e);
        }
    }
    return urls;
}
 
开发者ID:EricssonResearch,项目名称:trap,代码行数:18,代码来源:IndexConfigurator.java

示例4: addProjectDependenciesToClassRealm

import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluator; //导入方法依赖的package包/类
private void addProjectDependenciesToClassRealm(ExpressionEvaluator expressionEvaluator, ClassRealm containerRealm)
        throws ComponentConfigurationException
{
    List<String> runtimeClasspathElements;
    try
    {
        // noinspection unchecked
        runtimeClasspathElements = (List<String>) expressionEvaluator
                .evaluate("${project.runtimeClasspathElements}");
    }
    catch (ExpressionEvaluationException e)
    {
        throw new ComponentConfigurationException(
                "There was a problem evaluating: ${project.runtimeClasspathElements}", e);
    }

    // Add the project dependencies to the ClassRealm
    final URL[] urls = buildURLs(runtimeClasspathElements);
    for (URL url : urls)
    {
        containerRealm.addConstituent(url);
    }
}
 
开发者ID:protostuff,项目名称:protostuff,代码行数:24,代码来源:IncludeProjectDependenciesComponentConfigurator.java

示例5: testValueExtractionWithAPomValueContainingAPath

import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluator; //导入方法依赖的package包/类
public void testValueExtractionWithAPomValueContainingAPath()
    throws Exception
{
    String expected = getTestFile( "target/test-classes/target/classes" ).getCanonicalPath();

    Build build = new Build();
    build.setDirectory( expected.substring( 0, expected.length() - "/classes".length() ) );

    Model model = new Model();
    model.setBuild( build );

    MavenProject project = new MavenProject( model );
    project.setFile( new File( "pom.xml" ).getCanonicalFile() );

    ExpressionEvaluator expressionEvaluator = createExpressionEvaluator( project, null, new Properties() );

    Object value = expressionEvaluator.evaluate( "${project.build.directory}/classes" );
    String actual = new File( value.toString() ).getCanonicalPath();

    assertEquals( expected, actual );
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:22,代码来源:PluginParameterExpressionEvaluatorTest.java

示例6: testEscapedVariablePassthroughInLargerExpression

import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluator; //导入方法依赖的package包/类
public void testEscapedVariablePassthroughInLargerExpression()
    throws Exception
{
    String var = "${var}";
    String key = var + " with version: ${project.version}";

    Model model = new Model();
    model.setVersion( "1" );

    MavenProject project = new MavenProject( model );

    ExpressionEvaluator ee = createExpressionEvaluator( project, null, new Properties() );

    Object value = ee.evaluate( "$" + key );

    assertEquals( "${var} with version: 1", value );
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:18,代码来源:PluginParameterExpressionEvaluatorTest.java

示例7: testMultipleSubExpressionsInLargerExpression

import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluator; //导入方法依赖的package包/类
public void testMultipleSubExpressionsInLargerExpression()
    throws Exception
{
    String key = "${project.artifactId} with version: ${project.version}";

    Model model = new Model();
    model.setArtifactId( "test" );
    model.setVersion( "1" );

    MavenProject project = new MavenProject( model );

    ExpressionEvaluator ee = createExpressionEvaluator( project, null, new Properties() );

    Object value = ee.evaluate( key );

    assertEquals( "test with version: 1", value );
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:18,代码来源:PluginParameterExpressionEvaluatorTest.java

示例8: testPOMPropertyExtractionWithMissingProject_WithDotNotation

import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluator; //导入方法依赖的package包/类
public void testPOMPropertyExtractionWithMissingProject_WithDotNotation()
    throws Exception
{
    String key = "m2.name";
    String checkValue = "value";

    Properties properties = new Properties();
    properties.setProperty( key, checkValue );

    Model model = new Model();
    model.setProperties( properties );

    MavenProject project = new MavenProject( model );

    ExpressionEvaluator ee = createExpressionEvaluator( project, null, new Properties() );

    Object value = ee.evaluate( "${" + key + "}" );

    assertEquals( checkValue, value );
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:21,代码来源:PluginParameterExpressionEvaluatorTest.java

示例9: testValueExtractionFromSystemPropertiesWithMissingProject

import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluator; //导入方法依赖的package包/类
public void testValueExtractionFromSystemPropertiesWithMissingProject()
    throws Exception
{
    String sysprop = "PPEET_sysprop1";

    Properties executionProperties = new Properties();

    if ( executionProperties.getProperty( sysprop ) == null )
    {
        executionProperties.setProperty( sysprop, "value" );
    }

    ExpressionEvaluator ee = createExpressionEvaluator( null, null, executionProperties );

    Object value = ee.evaluate( "${" + sysprop + "}" );

    assertEquals( "value", value );
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:19,代码来源:PluginParameterExpressionEvaluatorTest.java

示例10: testValueExtractionFromSystemPropertiesWithMissingProject_WithDotNotation

import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluator; //导入方法依赖的package包/类
public void testValueExtractionFromSystemPropertiesWithMissingProject_WithDotNotation()
    throws Exception
{
    String sysprop = "PPEET.sysprop2";

    Properties executionProperties = new Properties();

    if ( executionProperties.getProperty( sysprop ) == null )
    {
        executionProperties.setProperty( sysprop, "value" );
    }

    ExpressionEvaluator ee = createExpressionEvaluator( null, null, executionProperties );

    Object value = ee.evaluate( "${" + sysprop + "}" );

    assertEquals( "value", value );
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:19,代码来源:PluginParameterExpressionEvaluatorTest.java

示例11: testTwoExpressions

import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluator; //导入方法依赖的package包/类
public void testTwoExpressions()
    throws Exception
{
    Build build = new Build();
    build.setDirectory( "expected-directory" );
    build.setFinalName( "expected-finalName" );

    Model model = new Model();
    model.setBuild( build );

    ExpressionEvaluator expressionEvaluator =
        createExpressionEvaluator( new MavenProject( model ), null, new Properties() );

    Object value = expressionEvaluator.evaluate( "${project.build.directory}" + FS + "${project.build.finalName}" );

    assertEquals( "expected-directory" + File.separatorChar + "expected-finalName", value );
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:18,代码来源:PluginParameterExpressionEvaluatorTest.java

示例12: handlePropertyEditorFields

import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluator; //导入方法依赖的package包/类
private void handlePropertyEditorFields(Object mojo,
		List<PropertyEditorField> editorSupportFields,
		ExpressionEvaluator expressionEvaluator) {
	for (PropertyEditorField propertyEditorField : editorSupportFields) {
		PropertyEditorComponent<?> propertyEditorComponent = propertyEditorLookup
				.getPropertyEditorComponent(propertyEditorField);
		String propertyName = propertyEditorField.getProperty();
		Object propValue;
		try {
			propValue = expressionEvaluator.evaluate("${" + propertyName
					+ "}");
			if (propValue == null) {
				continue;
			}
			String propertyValueString = null;
			propertyValueString = propValue.toString();
			propertyEditorField.setValue(propertyEditorComponent,
					propertyValueString);
		} catch (ExpressionEvaluationException e) {
			throw new IllegalStateException("Unable to inject "
					+ propertyEditorField + " with property named "
					+ propertyName, e);
		}
	}
}
 
开发者ID:link-intersystems,项目名称:maven,代码行数:26,代码来源:PropertyEditorSupportConverter.java

示例13: addProjectDependenciesToClassRealm

import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluator; //导入方法依赖的package包/类
private void addProjectDependenciesToClassRealm(ExpressionEvaluator expressionEvaluator, ClassRealm containerRealm)
		throws ComponentConfigurationException {
	List<String> runtimeClasspathElements;
	try {
		// noinspection unchecked
		runtimeClasspathElements = (List<String>) expressionEvaluator
				.evaluate("${project.runtimeClasspathElements}");
	} catch (ExpressionEvaluationException e) {
		throw new ComponentConfigurationException(
				"There was a problem evaluating: ${project.runtimeClasspathElements}", e);
	}

	// Add the project dependencies to the ClassRealm
	final URL[] urls = buildURLs(runtimeClasspathElements);
	for (URL url : urls) {
		containerRealm.addConstituent(url);
	}
}
 
开发者ID:raphaeljolivet,项目名称:java2typescript,代码行数:19,代码来源:IncludeProjectDependenciesComponentConfigurator.java

示例14: addProjectDependenciesToClassRealm

import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluator; //导入方法依赖的package包/类
private void addProjectDependenciesToClassRealm(
        final ExpressionEvaluator expressionEvaluator,
        final ClassRealm containerRealm)
        throws ComponentConfigurationException {

    List<String> testClasspathElements;

    try {
        // noinspection unchecked

        testClasspathElements = (List<String>) expressionEvaluator
                .evaluate("${project.testClasspathElements}");

    } catch (final ExpressionEvaluationException e) {
        throw new ComponentConfigurationException(
                "There was a problem evaluating: ${project.runtimeClasspathElements}",
                e);
    }

    if (testClasspathElements != null) {
        // Add the project test dependencies to the ClassRealm
        final URL[] testUrls = buildURLs(testClasspathElements);

        this.log.info("Adding the following jars to the Substeps classpath, tests will be executed with this classpath\n");

        for (final String s : testClasspathElements) {
            this.log.info("\t" + s);
        }
        this.log.info("\n\n");

        for (final URL url : testUrls) {

            containerRealm.addURL(url);
        }
    }

}
 
开发者ID:Substeps,项目名称:substeps-framework,代码行数:38,代码来源:IncludeProjectDependenciesComponentConfigurator.java

示例15: addProjectDependenciesToClassRealm

import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluator; //导入方法依赖的package包/类
private void addProjectDependenciesToClassRealm(ExpressionEvaluator expressionEvaluator, ClassRealm containerRealm) throws ComponentConfigurationException {
    List<String> runtimeClasspathElements;
    try {
        //noinspection unchecked
        runtimeClasspathElements = (List<String>) expressionEvaluator.evaluate("${project.runtimeClasspathElements}");
    } catch (ExpressionEvaluationException e) {
        throw new ComponentConfigurationException("There was a problem evaluating: ${project.runtimeClasspathElements}", e);
    }

    final URL[] urls = buildURLs(runtimeClasspathElements);
    for (URL url : urls) {
        containerRealm.addConstituent(url);
    }
}
 
开发者ID:brooklyncentral,项目名称:brooklyn-maven-plugin,代码行数:15,代码来源:IncludeProjectDependenciesComponentConfigurator.java


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