📄 shoulduseelement.java
字号:
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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -