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


Java ExpressionEvaluator类代码示例

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


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

示例1: simpleProperty

import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluator; //导入依赖的package包/类
static @NonNull ConfigurationBuilder<String> simpleProperty(final @NonNull String property) {
    return new ConfigurationBuilder<String>() {

        @Override
        public String build(Xpp3Dom configRoot, ExpressionEvaluator eval) {
            if (configRoot != null) {
                Xpp3Dom source = configRoot.getChild(property);
                if (source != null) {
                    String value = source.getValue();
                    if (value == null) {
                        return null;
                    }
                    return value.trim();
                }
            }
            return null;
        }
    };
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:PluginPropertyUtils.java

示例2: listProperty

import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluator; //导入依赖的package包/类
static @NonNull ConfigurationBuilder<String[]> listProperty(final @NonNull String multiProperty, final @NonNull String singleProperty) {
    return new ConfigurationBuilder<String[]>() {
        @Override
        public String[] build(Xpp3Dom conf, ExpressionEvaluator eval) {
            if (conf != null) {
                Xpp3Dom dom = (Xpp3Dom) conf; // MNG-4862
                Xpp3Dom source = dom.getChild(multiProperty);
                if (source != null) {
                    List<String> toRet = new ArrayList<String>();
                    Xpp3Dom[] childs = source.getChildren(singleProperty);
                    for (Xpp3Dom ch : childs) {
                        String chvalue = ch.getValue() == null ? "" : ch.getValue().trim();  //NOI18N
                        toRet.add(chvalue);  //NOI18N
                    }
                    return toRet.toArray(new String[toRet.size()]);
                }
            }
            return null;
        }
    };
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:22,代码来源:PluginPropertyUtils.java

示例3: createEvaluator

import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluator; //导入依赖的package包/类
/**
 * Evaluator usable for interpolating variables in non resolved (interpolated) models. 
 * Should not be necessary when dealing with the project's <code>MavenProject</code> instance accessed via<code>NbMavenProject.getMavenProject()</code>
 * @since 2.57
 */
public static @NonNull ExpressionEvaluator createEvaluator(@NonNull Project project) {
    NbMavenProjectImpl prj = project instanceof NbMavenProjectImpl ? (NbMavenProjectImpl)project : project.getLookup().lookup(NbMavenProjectImpl.class);
    assert prj != null;
    MavenProject mvnprj = prj.getOriginalMavenProject();
    //the idea here is to tie the lifecycle of the evaluator to the lifecycle of the MavenProject, both
    //get changed when settings.xml is changed or pom is change or when a profile gets updated..
    ExpressionEvaluator eval = (ExpressionEvaluator) mvnprj.getContextValue(CONTEXT_EXPRESSION_EVALUATOR);
    if (eval == null) {
        Settings ss = EmbedderFactory.getProjectEmbedder().getSettings();
        ss.setLocalRepository(EmbedderFactory.getProjectEmbedder().getLocalRepository().getBasedir());

        eval =  new NBPluginParameterExpressionEvaluator(
            mvnprj,
            ss,
            prj.createSystemPropsForPropertyExpressions(),
            prj.createUserPropsForPropertyExpressions());
        mvnprj.setContextValue(CONTEXT_EXPRESSION_EVALUATOR, eval);
    }
    return eval;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:26,代码来源:PluginPropertyUtils.java

示例4: configureComponent

import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluator; //导入依赖的package包/类
@Override
public void configureComponent(final Object component,
                               final PlexusConfiguration configuration,
                               final ExpressionEvaluator expressionEvaluator,
                               final ClassRealm containerRealm,
                               final ConfigurationListener listener)
        throws ComponentConfigurationException {

    addProjectDependenciesToClassRealm(expressionEvaluator, containerRealm);

    this.converterLookup.registerConverter(new ClassRealmConverter(containerRealm));

    final ObjectWithFieldsConverter converter = new ObjectWithFieldsConverter();

    converter.processConfiguration(this.converterLookup, component,
            containerRealm, configuration,
            expressionEvaluator, listener);

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

示例5: 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

示例6: addProjectDependenciesToClassRealm

import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluator; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private void addProjectDependenciesToClassRealm(ExpressionEvaluator expressionEvaluator, ClassRealm containerRealm)
    throws ComponentConfigurationException
{
  Set<String> runtimeClasspathElements = new HashSet<String>();
  try
  {
    runtimeClasspathElements.addAll((List<String>) expressionEvaluator
        .evaluate("${project.runtimeClasspathElements}"));
    
  }
  catch (ExpressionEvaluationException e)
  {
    throw new ComponentConfigurationException("There was a problem evaluating: ${project.runtimeClasspathElements}",
        e);
  }
  
  Collection<URL> urls = buildURLs(runtimeClasspathElements);
  urls.addAll(buildAritfactDependencies(expressionEvaluator));
  for (URL url : urls)
  {
    // containerRealm.addConstituent(url);
    containerRealm.addURL(url);
  }
}
 
开发者ID:iisi-nj,项目名称:GemFireLite,代码行数:26,代码来源:DomainMojoConfigurator.java

示例7: 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

示例8: addProjectDependenciesToClassRealm

import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluator; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private void addProjectDependenciesToClassRealm(ExpressionEvaluator expressionEvaluator, ClassRealm containerRealm) throws ComponentConfigurationException {
    Set<String> runtimeClasspathElements = new HashSet<String>();
    try {
        runtimeClasspathElements.addAll((List<String>) expressionEvaluator.evaluate("${project.runtimeClasspathElements}"));

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

    Collection<URL> urls = this.buildURLs(runtimeClasspathElements);
    urls.addAll(this.buildAritfactDependencies(expressionEvaluator));
    for (URL url : urls) {
        containerRealm.addConstituent(url);
    }
}
 
开发者ID:EricssonResearch,项目名称:trap,代码行数:17,代码来源:IndexConfigurator.java

示例9: 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

示例10: 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

示例11: fromConfiguration

import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluator; //导入依赖的package包/类
private JdkToolchain fromConfiguration( PlexusConfiguration configuration, ExpressionEvaluator expressionEvaluator )
    throws ComponentConfigurationException
{
    PlexusConfiguration[] params = configuration.getChildren();
    Map parameters = new HashMap();
    for ( int j = 0; j < params.length; j++ )
    {
        try
        {
            String name = params[j].getName();
            String val = params[j].getValue();
            parameters.put( name, val );
        }
        catch ( PlexusConfigurationException ex )
        {
            throw new ComponentConfigurationException( ex );
        }
    }
    final JdkToolchain result = new JdkToolchain();
    result.setParameters( Collections.unmodifiableMap( parameters ) );
    return result;
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:23,代码来源:JdkToolchainConverter.java

示例12: 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

示例13: 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

示例14: 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

示例15: 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


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