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


Java TreeValueExpression类代码示例

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


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

示例1: JuelFunction

import de.odysseus.el.TreeValueExpression; //导入依赖的package包/类
public JuelFunction(String juelExpression, Class<T> resultClass, Map<String, Class<?>> arguments) {
            // Initialize the JUEL conext.
            this.expressionFactory = new de.odysseus.el.ExpressionFactoryImpl();
            this.initializeContext(this.context = new SimpleContext());

            // Index the arguments.
            Class<?>[] argumentTypeClasses = new Class[arguments.size()];
            int argIndex = 0;
            for (Map.Entry<String, Class<?>> argumentEntry : arguments.entrySet()) {
                final String argName = argumentEntry.getKey();
                final Class<?> argTypeClass = argumentEntry.getValue();
                final TreeValueExpression argExpression =
                        this.expressionFactory.createValueExpression(this.context, String.format("${%s}", argName), argTypeClass);
                Argument argument = new Argument(argIndex++, argTypeClass, argExpression);
                argumentTypeClasses[argument.index] = argument.typeClass;
                this.arguments.put(argName, argument);
            }

            // Create the JUEL method.
            this.expression = expressionFactory.createValueExpression(this.context, juelExpression, resultClass);
//            this.expression = expressionFactory.createMethodExpression(this.context, juelExpression, resultClass, argumentTypeClasses);
        }
 
开发者ID:daqcri,项目名称:rheem,代码行数:23,代码来源:JuelUtils.java

示例2: createExpression

import de.odysseus.el.TreeValueExpression; //导入依赖的package包/类
public ElExpression createExpression(String expression) {
  TreeValueExpression juelExpr = factory.createValueExpression(parsingElContext, expression, Object.class);
  return new JuelExpression(juelExpr, elContextFactory);
}
 
开发者ID:camunda,项目名称:camunda-engine-dmn,代码行数:5,代码来源:JuelElProvider.java

示例3: execute

import de.odysseus.el.TreeValueExpression; //导入依赖的package包/类
@Override
public void execute() throws MojoExecutionException, MojoFailureException {
    initClient();

    SimpleContext context = new SimpleContext();

    for(String variable : variables) {
        context.getELResolver().setValue(context, null, variable, project.getProperties().getProperty(variable));
    }

    try {
        Map<String, String> changes = new HashMap<String, String>();
        for(Property property : properties) {
            String propertyValue = project.getProperties().getProperty(property.getName());

            getLog().info(String.format("%s = %s", property.getName(), propertyValue));

            if(StringUtils.equalsIgnoreCase(propertyValue, "latest")) {
                String name = property.getJobExpr();

                Matcher matcher = EXPRESSION_PATTERN.matcher(name);

                if(matcher.find()) {
                    String content = matcher.group(1);

                    TreeValueExpression expr = (TreeValueExpression) expressionFactory.createValueExpression(context, String.format("${%s}", content), String.class);
                    name = (String) expr.getValue(context);
                }


                JobDetails jobDetails = client.getJobDetails(name);

                changes.put(property.getName() + "-modified", String.valueOf(jobDetails.getLastSuccessfulBuild().getNumber()));
            } else {
                changes.put(String.format("%s-modified", property.getName()), propertyValue);
            }
        }

        if(MapUtils.isNotEmpty(changes)) {
            getLog().info(String.format("Property changes: %s", changes));

            for(Map.Entry<String, String> entry : changes.entrySet()) {
                if(entry.getValue() == null) {
                    continue;
                }

                project.getProperties().setProperty(entry.getKey(), entry.getValue());
            }
        }
    } catch(Exception e) {
        throw new MojoExecutionException(e.getMessage(), e);
    }
}
 
开发者ID:jenkinsmvn,项目名称:jenkinsmvn,代码行数:54,代码来源:PropertyMojo.java


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