📄 wtktool.java
字号:
package org.momeunit.ant.core;import java.io.File;import java.util.Enumeration;import java.util.HashSet;import java.util.Properties;import java.util.Set;import org.apache.tools.ant.Task;import org.apache.tools.ant.types.Path;/** * Base class of all WTK tools. Contains method for setting and accessing WTK * home directory, classpath and owning task. Contains method for * modifying properties to configure WTK tool behavior: * {@link #setProperty(String, String)}, {@link #addProperties(Properties)} and * accessing them {@link #getProperty(String)}, {@link #propertyNames()}. * * <p> * <strong>Note:</strong> Method {@link #setClasspath(Path)} sets classpath to * the given value not appends it. * </p> * * @author Sergio Morozov * @version 1.1.2 */public class WtkTool{ private File wtkHome = null; private Path classpath = null; private Properties props = null; private Task task = null; /** * Instantiates WtkTool with given WTK home directory. * * @param wtkHome * WTK home directory. * @since 1.1 */ public WtkTool(File wtkHome) { super(); this.setWtkHome(wtkHome); this.props = new Properties(); } /** * Instantiates WtkTool. * * @since 1.1 */ public WtkTool() { this(null); } /** * Sets WTK home directory. * * @param wtkHome * WTK home directory. * @since 1.1 */ public void setWtkHome(File wtkHome) { this.wtkHome = wtkHome; } /** * Returns WTK home directory. * * @return WTK home directory. * @since 1.1 */ public File getWtkHome() { return this.wtkHome; } /** * Returns owning task. * * @return owning task. * @since 1.1 */ public Task getTask() { return this.task; } /** * Sets owning task * * @param task * owning task to set. * @since 1.1 */ public void setTask(Task task) { this.task = task; } /** * Returns classpath. * * @return the classpath * @since 1.1 */ public Path getClasspath() { return this.classpath; } /** * Sets (not appends) classpath. * * @param classpath * the classpath to set (not appended). * @since 1.1 */ public void setClasspath(Path classpath) { this.classpath = classpath; } /** * Sets property that configures WTK tool behavior if <code>value</code> is * not <code>null</code>, removes property otherwise. * * @param name * name of the property to set or remove. Can't be <code>null</code>. * @param value * value of the property to set or <code>null</code> to remove the * property. * @since 1.1 */ public void setProperty(String name, String value) { if (value != null) this.props.setProperty(name, value); else this.props.remove(name); } /** * Adds properties that configures WTK tool behavior. * * @param props * properties that configures WTK tool behavior. * @since 1.1 */ public void addProperties(Properties props) { this.props.putAll(props); } /** * Returns property of the given <code>name</code> or <code>null</code> if * not found. * * @param name * name of the property to return. * @return property of the given <code>name</code> or <code>null</code> if * not found. * @since 1.1 */ public String getProperty(String name) { return name != null ? this.props.getProperty(name) : null; } /** * Returns collection of properties names. * * @return Set of properties names. * @since 1.1 */ public Set propertyNames() { return new HashSet(this.props.keySet()); } /** * Returns enumeration of properties names. * * @return the {@link Enumeration} of properties names. * @since 1.1.2 */ public Enumeration enumeratePropertyNames() { return this.props.propertyNames(); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -