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

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

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

Expression.evaluateAsBoolean介绍

[英]Evaluates the expression with the given context coercing the result to be a boolean.
[中]使用给定上下文对表达式求值,将结果强制为布尔值。

代码示例

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

public void doTag(XMLOutput output) throws BreakException {
  boolean broken = false;
  if (test == null || test.evaluateAsBoolean(context)) {
    broken = true;
  }
  if ( var != null ) {
    context.setVariable( this.var, String.valueOf(broken));
  }
  if ( broken ) {
    throw new BreakException();
  }
}

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

public void doTag(XMLOutput output) throws BreakException {
  boolean broken = false;
  if (test == null || test.evaluateAsBoolean(context)) {
    broken = true;
  }
  if ( var != null ) {
    context.setVariable( this.var, String.valueOf(broken));
  }
  if ( broken ) {
    throw new BreakException();
  }
}

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

public void doTag(XMLOutput output) throws MissingAttributeException, JellyTagException {
  if (test != null) {
    if (test.evaluateAsBoolean(context)) {
      invokeBody(output);
    }
  }
  else {
    throw new MissingAttributeException( "test" );
  }
}

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

public void doTag(XMLOutput output) throws BreakException {
  boolean broken = false;
  if (test == null || test.evaluateAsBoolean(context)) {
    broken = true;
  }
  if ( var != null ) {
    context.setVariable( this.var, String.valueOf(broken));
  }
  if ( broken ) {
    throw new BreakException();
  }
}

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

public void doTag(XMLOutput output) throws BreakException {
  boolean broken = false;
  if (test == null || test.evaluateAsBoolean(context)) {
    broken = true;
  }
  if ( var != null ) {
    context.setVariable( this.var, String.valueOf(broken));
  }
  if ( broken ) {
    throw new BreakException();
  }
}

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

public void doTag(XMLOutput output) throws MissingAttributeException, JellyTagException {
  if (test != null) {
    if (test.evaluateAsBoolean(context)) {
      invokeBody(output);
    }
  }
  else {
    throw new MissingAttributeException( "test" );
  }
}

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

public void doTag(XMLOutput output) throws MissingAttributeException, JellyTagException {
  if (test != null) {
    if (test.evaluateAsBoolean(context)) {
      invokeBody(output);
    }
  }
  else {
    throw new MissingAttributeException( "test" );
  }
}

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

public void doTag(XMLOutput output) throws MissingAttributeException, JellyTagException {
  if (test != null) {
    if (test.evaluateAsBoolean(context)) {
      invokeBody(output);
    }
  }
  else {
    throw new MissingAttributeException( "test" );
  }
}

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

/**
 * Tag interface
 * @param output destination for xml output
 * @throws MissingAttributeException when the test attribute is missing
 * @throws Exception for anything else
 */
public void doTag(XMLOutput output) throws MissingAttributeException, JellyTagException {
  if (test != null) {
    try {
      while (test.evaluateAsBoolean(getContext())) {
        if (log.isDebugEnabled()) {
          log.debug("evaluated to true! gonna keep on chuggin!");
        }
        invokeBody(output);
      }
    }
    catch (BreakException e) {
      if (log.isDebugEnabled()) {
        log.debug("loop terminated by break: " + e, e);
      }
    }
  }
  else {
    throw new MissingAttributeException("test");
  }
}

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

/**
 * Tag interface
 * @param output destination for xml output
 * @throws MissingAttributeException when the test attribute is missing
 * @throws Exception for anything else
 */
public void doTag(XMLOutput output) throws MissingAttributeException, JellyTagException {
  if (test != null) {
    try {
      while (test.evaluateAsBoolean(getContext())) {
        if (log.isDebugEnabled()) {
          log.debug("evaluated to true! gonna keep on chuggin!");
        }
        invokeBody(output);
      }
    }
    catch (BreakException e) {
      if (log.isDebugEnabled()) {
        log.debug("loop terminated by break: " + e, e);
      }
    }
  }
  else {
    throw new MissingAttributeException("test");
  }
}

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

/**
 * Tag interface
 * @param output destination for xml output
 * @throws MissingAttributeException when the test attribute is missing
 * @throws Exception for anything else
 */
public void doTag(XMLOutput output) throws MissingAttributeException, JellyTagException {
  if (test != null) {
    try {
      while (test.evaluateAsBoolean(getContext())) {
        if (log.isDebugEnabled()) {
          log.debug("evaluated to true! gonna keep on chuggin!");
        }
        invokeBody(output);
      }
    }
    catch (BreakException e) {
      if (log.isDebugEnabled()) {
        log.debug("loop terminated by break: " + e, e);
      }
    }
  }
  else {
    throw new MissingAttributeException("test");
  }
}

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

/**
 * Tag interface
 * @param output destination for xml output
 * @throws MissingAttributeException when the test attribute is missing
 * @throws Exception for anything else
 */
public void doTag(XMLOutput output) throws MissingAttributeException, JellyTagException {
  if (test != null) {
    try {
      while (test.evaluateAsBoolean(getContext())) {
        if (log.isDebugEnabled()) {
          log.debug("evaluated to true! gonna keep on chuggin!");
        }
        invokeBody(output);
      }
    }
    catch (BreakException e) {
      if (log.isDebugEnabled()) {
        log.debug("loop terminated by break: " + e, e);
      }
    }
  }
  else {
    throw new MissingAttributeException("test");
  }
}

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

public void run(JellyContext context, XMLOutput output) throws JellyTagException {
    if (getAttribute("test").evaluateAsBoolean(context))
      getTagBody().run(context,output);
  }
};

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

public void run(JellyContext context, XMLOutput output) throws JellyTagException {
    if (getAttribute("test").evaluateAsBoolean(context))
      getTagBody().run(context,output);
  }
};

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

public void run(JellyContext context, XMLOutput output) throws JellyTagException {
    if (getAttribute("test").evaluateAsBoolean(context))
      getTagBody().run(context,output);
  }
};

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

public void doTag(XMLOutput output) throws JellyTagException {
  ChooseTag tag = (ChooseTag) findAncestorWithClass( ChooseTag.class );
  if ( tag == null ) {
    throw new JellyTagException( "This tag must be enclosed inside a <choose> tag" );
  }
  if ( ! tag.isBlockEvaluated() && test != null ) {
    if ( test.evaluateAsBoolean( context ) ) {
      tag.setBlockEvaluated(true);
      invokeBody(output);
    }
  }
}

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

public void doTag(XMLOutput output) throws JellyTagException {
  ChooseTag tag = (ChooseTag) findAncestorWithClass( ChooseTag.class );
  if ( tag == null ) {
    throw new JellyTagException( "This tag must be enclosed inside a <choose> tag" );
  }
  if ( ! tag.isBlockEvaluated() && test != null ) {
    if ( test.evaluateAsBoolean( context ) ) {
      tag.setBlockEvaluated(true);
      invokeBody(output);
    }
  }
}

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

public void doTag(XMLOutput output) throws JellyTagException {
  ChooseTag tag = (ChooseTag) findAncestorWithClass( ChooseTag.class );
  if ( tag == null ) {
    throw new JellyTagException( "This tag must be enclosed inside a <choose> tag" );
  }
  if ( ! tag.isBlockEvaluated() && test != null ) {
    if ( test.evaluateAsBoolean( context ) ) {
      tag.setBlockEvaluated(true);
      invokeBody(output);
    }
  }
}

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

public void doTag(XMLOutput output) throws JellyTagException {
  ChooseTag tag = (ChooseTag) findAncestorWithClass( ChooseTag.class );
  if ( tag == null ) {
    throw new JellyTagException( "This tag must be enclosed inside a <choose> tag" );
  }
  if ( ! tag.isBlockEvaluated() && test != null ) {
    if ( test.evaluateAsBoolean( context ) ) {
      tag.setBlockEvaluated(true);
      invokeBody(output);
    }
  }
}

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

public void doTag(XMLOutput output) throws JellyTagException {
  if (test == null && xpath == null) {
    throw new MissingAttributeException( "test" );
  }
  if (test != null) {
    if (! test.evaluateAsBoolean(context)) {
      fail( getBodyText(), "evaluating test: "+ test.getExpressionText() );
    }
  }
  else {
    try {
      Object xpathContext = getXPathContext();
      if (! xpath.booleanValueOf(xpathContext)) {
        fail( getBodyText(), "evaluating xpath: "+ xpath );
      }
    } catch (JaxenException anException) {
      throw new JellyTagException("Error evaluating xpath", anException);
    }
  }
}

相关文章