org.apache.commons.jelly.expression.Expression.evaluate()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(5.8k)|赞(0)|评价(0)|浏览(177)

本文整理了Java中org.apache.commons.jelly.expression.Expression.evaluate()方法的一些代码示例,展示了Expression.evaluate()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Expression.evaluate()方法的具体详情如下:
包路径:org.apache.commons.jelly.expression.Expression
类名称:Expression
方法名:evaluate

Expression.evaluate介绍

[英]Evaluates the expression with the given context and returns the result
[中]使用给定上下文计算表达式并返回结果

代码示例

代码示例来源:origin: jenkinsci/jenkins

private Object evalAttribute(String name, JellyContext context) {
  ExpressionAttribute e = attributes.get(name);
  if (e==null)    return null;
  return e.exp.evaluate(context);
}

代码示例来源:origin: org.eclipse.hudson.stapler/stapler-jelly

Object[] evaluateArguments(JellyContext jellyContext) {
  Object[] args = new Object[arguments.length];
  for (int i = 0; i < args.length; i++)
    args[i] = arguments[i].evaluate(jellyContext);
  return args;
}

代码示例来源:origin: org.jenkins-ci.main/jenkins-core

private Object evalAttribute(String name, JellyContext context) {
  ExpressionAttribute e = attributes.get(name);
  if (e==null)    return null;
  return e.exp.evaluate(context);
}

代码示例来源:origin: org.eclipse.hudson/hudson-core

private Object evalAttribute(String name, JellyContext context) {
  ExpressionAttribute e = attributes.get(name);
  if (e == null) {
    return null;
  }
  return e.exp.evaluate(context);
}

代码示例来源:origin: org.eclipse.hudson.main/hudson-core

private Object evalAttribute(String name, JellyContext context) {
  ExpressionAttribute e = attributes.get(name);
  if (e==null)    return null;
  return e.exp.evaluate(context);
}

代码示例来源:origin: org.hudsonci.stapler/commons-jelly

public Object evaluate(JellyContext context) {
  Object r = base.evaluate(context);
  if (r==null)    return null;
  return escape(r.toString());
}

代码示例来源:origin: org.jenkins-ci/commons-jelly

public Object evaluate(JellyContext context) {
  Object r = base.evaluate(context);
  if (r==null)    return null;
  return escape(r.toString());
}

代码示例来源:origin: commons-jelly/commons-jelly

public Object evaluate(JellyContext context) {
  Object answer = jexlExpression.evaluate(context);
  if ( answer == null ) {
    answer = context.getVariable(text);
  }
  return answer;
}

代码示例来源:origin: org.hudsonci.stapler/commons-jelly

public Object evaluate(JellyContext context) {
  Object answer = jexlExpression.evaluate(context);
  if ( answer == null ) {
    answer = context.getVariable(text);
  }
  return answer;
}

代码示例来源:origin: org.jenkins-ci/commons-jelly

public Object evaluate(JellyContext context) {
  Object answer = jexlExpression.evaluate(context);
  if ( answer == null ) {
    answer = context.getVariable(text);
  }
  return answer;
}

代码示例来源:origin: org.eclipse.hudson.stapler/stapler-jelly

public Object evaluate(JellyContext context) {
    context = new CustomJellyContext(context);
    context.setVariables(resourceLiterals);
    return innerExpression.evaluate(context);
  }
}

代码示例来源:origin: stapler/stapler

public Object evaluate(JellyContext context) {
    context = new CustomJellyContext(context);
    context.setVariables(resourceLiterals);
    return innerExpression.evaluate(context);
  }
}

代码示例来源:origin: org.jvnet.hudson/commons-jelly

/** Evaluates the body of a tag */
  public void run(JellyContext context, XMLOutput output) throws JellyTagException {
    Object result = expression.evaluate(context);
    if ( result != null ) {

      try {
       output.objectData(result);
      } catch (SAXException e) {
        throw new JellyTagException("Could not write to XMLOutput",e);
      }

    }
  }
}

代码示例来源:origin: org.jenkins-ci/commons-jelly

public void doTag(XMLOutput output) throws MissingAttributeException, JellyTagException {
  this.defaultEncountered = false;
  this.someCaseMatched = false;
  this.fallingThru = false;
      
  if(null == on) {
    throw new MissingAttributeException("on");
  } else {
    value = on.evaluate(context);
    invokeBody(output);
  }
}

代码示例来源:origin: org.hudsonci.stapler/commons-jelly

/** Evaluates the body of a tag */
  public void run(JellyContext context, XMLOutput output) throws JellyTagException {
    Object result = expression.evaluate(context);
    if ( result != null ) {

      try {
       output.objectData(result);
      } catch (SAXException e) {
        throw new JellyTagException("Could not write to XMLOutput",e);
      }

    }
  }
}

代码示例来源:origin: commons-jelly/commons-jelly

/** Evaluates the body of a tag */
  public void run(JellyContext context, XMLOutput output) throws JellyTagException {
    Object result = expression.evaluate(context);
    if ( result != null ) {

      try {
       output.objectData(result);
      } catch (SAXException e) {
        throw new JellyTagException("Could not write to XMLOutput",e);
      }

    }
  }
}

代码示例来源:origin: org.jvnet.hudson/commons-jelly

public void doTag(XMLOutput output) throws MissingAttributeException, JellyTagException {
  this.defaultEncountered = false;
  this.someCaseMatched = false;
  this.fallingThru = false;
      
  if(null == on) {
    throw new MissingAttributeException("on");
  } else {
    value = on.evaluate(context);
    invokeBody(output);
  }
}

代码示例来源:origin: org.hudsonci.stapler/commons-jelly

public void doTag(XMLOutput output) throws MissingAttributeException, JellyTagException {
  this.defaultEncountered = false;
  this.someCaseMatched = false;
  this.fallingThru = false;
      
  if(null == on) {
    throw new MissingAttributeException("on");
  } else {
    value = on.evaluate(context);
    invokeBody(output);
  }
}

代码示例来源:origin: commons-jelly/commons-jelly

protected void assertExpression(String expressionText, Object expectedValue) throws Exception {
    Expression expression = CompositeExpression.parse(expressionText, factory);
    assertTrue( "Created a valid expression for: " + expressionText, expression != null );
    Object value = expression.evaluate(context);
    //assertEquals( "Expression for: " + expressionText + " is: " + expression, expectedValue, value );
    assertEquals( "Wrong result for expression: " + expressionText, expectedValue, value );
  }
}

代码示例来源:origin: commons-jelly/commons-jelly

protected void assertExpression(String expressionText, Object expectedValue) throws Exception {
    Expression expression = CompositeExpression.parse(expressionText, factory);
    assertTrue( "Created a valid expression for: " + expressionText, expression != null );
    Object value = expression.evaluate(context);
    assertEquals( "Wrong result for expression: " + expressionText, expectedValue, value );

    String text = expression.getExpressionText();
    assertEquals( "Wrong textual representation for expression text: ", expressionText, text);
  }
}

相关文章