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

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

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

Expression.evaluateAsString介绍

[英]Evaluates the expression with the given context coercing the result to be a String.
[中]使用将结果强制为字符串的给定上下文计算表达式。

代码示例

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

actual.addAttribute("",name,name,"CDATA",expression.evaluateAsString(context));

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

public String evaluateAsString(JellyContext context) {
  StringBuffer buffer = new StringBuffer();
  for (Iterator iter = expressions.iterator(); iter.hasNext(); ) {
    Expression expression = (Expression) iter.next();
    String value = expression.evaluateAsString(context);
    if ( value != null ) {
      buffer.append( value );
    }
  }
  return buffer.toString();
}

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

public String evaluateAsString(JellyContext context) {
  StringBuffer buffer = new StringBuffer();
  for (Iterator iter = expressions.iterator(); iter.hasNext(); ) {
    Expression expression = (Expression) iter.next();
    String value = expression.evaluateAsString(context);
    if ( value != null ) {
      buffer.append( value );
    }
  }
  return buffer.toString();
}

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

public String evaluateAsString(JellyContext context) {
  StringBuffer buffer = new StringBuffer();
  for (Iterator iter = expressions.iterator(); iter.hasNext(); ) {
    Expression expression = (Expression) iter.next();
    String value = expression.evaluateAsString(context);
    if ( value != null ) {
      buffer.append( value );
    }
  }
  return buffer.toString();
}

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

public String evaluateAsString(JellyContext context) {
  StringBuffer buffer = new StringBuffer();
  for (Iterator iter = expressions.iterator(); iter.hasNext(); ) {
    Expression expression = (Expression) iter.next();
    String value = expression.evaluateAsString(context);
    if ( value != null ) {
      buffer.append( value );
    }
  }
  return buffer.toString();
}

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

public void doTag(XMLOutput output) throws MissingAttributeException, JellyTagException {
    final String text = value.evaluateAsString(context);
    if (text != null) {
      StringBuilder buf = new StringBuilder(text.length());
      for (int i=0; i<text.length(); i++ ) {
        char ch = text.charAt(i);
        switch(ch) {
        case '<':       buf.append("&lt;");     break;
        case '&':       buf.append("&amp;");    break;
        default:        buf.append(ch);
        }
      }

      try {
        output.write(buf.toString());
      }
      catch (SAXException e) {
        throw new JellyTagException("could not write the XMLOutput",e);
      }
    }
  }
}

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

public void doTag(XMLOutput output) throws MissingAttributeException {
  if (var != null) {
    context.removeVariable( var.evaluateAsString(context) );
  }
  else {
    throw new MissingAttributeException("var");
  }
}

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

/**
   * Adds {@link XMLOutput} to the context.
   */
  public void run(JellyContext context, XMLOutput output) throws JellyTagException {
    context.setVariable(getAttribute("var").evaluateAsString(context),output);
  }
};

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

/**
   * Adds {@link XMLOutput} to the context.
   */
  public void run(JellyContext context, XMLOutput output) throws JellyTagException {
    context.setVariable(getAttribute("var").evaluateAsString(context),output);
  }
};

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

public void doTag(XMLOutput output) throws MissingAttributeException {
  if (var != null) {
    context.removeVariable( var.evaluateAsString(context) );
  }
  else {
    throw new MissingAttributeException("var");
  }
}

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

public void doTag(XMLOutput output) throws JellyTagException {
  if (value != null) {
    String text = value.evaluateAsString(context);
    if (text != null) {
      try {
        output.write(text);
      }
      catch (SAXException e) {
        throw new JellyTagException("could not write the XMLOutput",e);
      }
    }
  }
}

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

public void doTag(XMLOutput output) throws MissingAttributeException {
  if (var != null) {
    context.removeVariable( var.evaluateAsString(context) );
  }
  else {
    throw new MissingAttributeException("var");
  }
}

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

public void doTag(XMLOutput output) throws JellyTagException {
  if (value != null) {
    String text = value.evaluateAsString(context);
    if (text != null) {
      try {
        output.write(text);
      }
      catch (SAXException e) {
        throw new JellyTagException("could not write the XMLOutput",e);
      }
    }
  }
}

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

public void doTag(XMLOutput output) throws MissingAttributeException {
  if (var != null) {
    context.removeVariable( var.evaluateAsString(context) );
  }
  else {
    throw new MissingAttributeException("var");
  }
}

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

public void doTag(XMLOutput output) throws JellyTagException {
  if (value != null) {
    String text = value.evaluateAsString(context);
    if (text != null) {
      try {
        output.write(text);
      }
      catch (SAXException e) {
        throw new JellyTagException("could not write the XMLOutput",e);
      }
    }
  }
}

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

public void doTag(XMLOutput output) throws JellyTagException {
  if (value != null) {
    String text = value.evaluateAsString(context);
    if (text != null) {
      try {
        output.write(text);
      }
      catch (SAXException e) {
        throw new JellyTagException("could not write the XMLOutput",e);
      }
    }
  }
}

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

/**
 * Get the POM with all variables resolved.
 * 
 * @param project
 *            the project to resolve
 * @param context
 *            the context to retrieve variables from
 * @return a project with no unresolved elements.
 * @throws Exception
 *             if there is an error parsing the project FIXME
 */
private static Project getInterpolatedPOM( Project project, JellyContext context ) throws Exception
{
  String projectString = project.getProjectAsString();
  Expression e = JellyUtils.decomposeExpression( projectString, context );
  String newProjectString = e.evaluateAsString( context );
  // We can use a Reader and not an URL/path here to read
  // the POM because this is a memory model without XML entities.
  project = new Project( new StringReader( newProjectString ) );
  return project;
}

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

public Object evaluate(JellyContext context) {
  this.context = context;
  try
  {
    XPath xpath = new Dom4jXPath( this.xpathExpr.evaluateAsString( context ) );
    xpath.setVariableContext(this);
    if (log.isDebugEnabled()) {
      log.debug( "Setting the namespace context to be: " + uris );
    }
    xpath.setNamespaceContext( new SimpleNamespaceContext( this.uris ) );
    return xpath;
  }
  catch (JaxenException e)
  {
    log.error( "Error constructing xpath",
          e );
  }
  return null;
}

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

public Object evaluate(JellyContext context) {
  this.context = context;
  try
  {
    XPath xpath = new Dom4jXPath( this.xpathExpr.evaluateAsString( context ) );
    xpath.setVariableContext(this);
    if (log.isDebugEnabled()) {
      log.debug( "Setting the namespace context to be: " + uris );
    }
    xpath.setNamespaceContext( new SimpleNamespaceContext( this.uris ) );
    return xpath;
  }
  catch (JaxenException e)
  {
    log.error( "Error constructing xpath",
          e );
  }
  return null;
}

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

public Object evaluate(JellyContext context) {
  this.context = context;
  try
  {
    XPath xpath = new Dom4jXPath( this.xpathExpr.evaluateAsString( context ) );
    xpath.setVariableContext(this);
    if (log.isDebugEnabled()) {
      log.debug( "Setting the namespace context to be: " + uris );
    }
    xpath.setNamespaceContext( new SimpleNamespaceContext( this.uris ) );
    return xpath;
  }
  catch (JaxenException e)
  {
    log.error( "Error constructing xpath",
          e );
  }
  return null;
}

相关文章