shoulduseelement.java

来自「MoMEUnit是一个单元测试的J2ME的应用程序xUnit架构实例。这是来自J」· Java 代码 · 共 57 行

JAVA
57
字号
package org.momeunit.ant.taskdefs;import org.apache.tools.ant.Task;/** * Base class for elements that contain if/unless functionality. Contains method * {@link #shouldUse(Task)} for quering element's allowance. *  * @author Sergio Morozov * @version 1.1.2 */public class ShouldUseElement{  private String ifProp = null;  private String unlessProp = null;  /**   * Sets name of property to be set to allow this element.   *    * @param ifProp   *          name of property to be set to allow this element.   * @since 1.1   */  public void setIf(String ifProp)  {    this.ifProp = ifProp != null ? ifProp.trim() : null;  }  /**   * Sets name of property to be unset to allow this element.   *    * @param unlessProp   *          Sets name of property to be unset to allow this element.   * @since 1.1   */  public void setUnless(String unlessProp)  {    this.unlessProp = unlessProp != null ? unlessProp.trim() : null;  }  /**   * Queries is this element allowed.   *    * @param task   *          owning task.   * @return <code>true</code> if this element is allowed, <code>false</code>   *         otherwise.   * @since 1.1   */  public boolean shouldUse(Task task)  {    return (ifProp == null || task.getProject().getProperty(ifProp) != null)        && (unlessProp == null || task.getProject().getProperty(unlessProp) == null);  }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?