diff --git a/src/main/org/apache/tools/ant/taskdefs/Ant.java b/src/main/org/apache/tools/ant/taskdefs/Ant.java index cacfb66ed..90d6b57e6 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Ant.java +++ b/src/main/org/apache/tools/ant/taskdefs/Ant.java @@ -535,16 +535,29 @@ public class Ant extends Task { public static class Reference extends org.apache.tools.ant.types.Reference { + /** Creates a reference to be configured by Ant */ public Reference() { super(); } private String targetid = null; + /** + * Set the id that this reference to be stored under in the + * new project. + * + * @param targetid the id under which this reference will be passed to + * the new project */ public void setToRefid(String targetid) { this.targetid = targetid; } + /** + * Get the id under which this reference will be stored in the new + * project + * + * @return the id of the reference in the new project. + */ public String getToRefid() { return targetid; } diff --git a/src/main/org/apache/tools/ant/taskdefs/Available.java b/src/main/org/apache/tools/ant/taskdefs/Available.java index 3da8b8d92..f2ad26667 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Available.java +++ b/src/main/org/apache/tools/ant/taskdefs/Available.java @@ -69,7 +69,7 @@ import org.apache.tools.ant.util.StringUtils; /** * Will set the given property if the requested resource is available at - * runtime. + * runtime. This task may also be used as a condition by the condition task. * * @author Stefano Mazzocchi * stefano@apache.org @@ -93,10 +93,21 @@ public class Available extends Task implements Condition { private boolean isTask = false; private boolean ignoreSystemclasses = false; + /** + * Set the classpath to be used when searching for classes and resources + * + * @param classpath an Ant Path object containing the search path. + */ public void setClasspath(Path classpath) { createClasspath().append(classpath); } + /** + * Create a classpath object to be configured by Ant. The resulting + * path will be used when searching for classes or resources + * + * @return an empty Path instance to be configured by Ant. + */ public Path createClasspath() { if (this.classpath == null) { this.classpath = new Path(project); @@ -104,14 +115,31 @@ public class Available extends Task implements Condition { return this.classpath.createPath(); } + /** + * Set the classpath by reference. + * + * @param r a Reference to a Path instance to be used as the classpath + * value. + */ public void setClasspathRef(Reference r) { createClasspath().setRefid(r); } + /** + * Set the path to use when looking for a file + * + * @param filepath a Path instance containing the search path for files. + */ public void setFilepath(Path filepath) { createFilepath().append(filepath); } + /** + * Create a filepath to be configured by Ant. + * + * @return a new Path instance which Ant will configure with a file search + * path. + */ public Path createFilepath() { if (this.filepath == null) { this.filepath = new Path(project); @@ -119,24 +147,53 @@ public class Available extends Task implements Condition { return this.filepath.createPath(); } + /** + * Set the name of the property which will be set if the particular resource + * is available. + * + * @param property the name of the property to set. + */ public void setProperty(String property) { this.property = property; } + /** + * Set the value to be given to the property of the desired resource is + * available. + * + * @param value the value to be given. + */ public void setValue(String value) { this.value = value; } + /** + * Set a classname of a class which must be available to set the given + * property. + * + * @param classname the name of the class required. + */ public void setClassname(String classname) { if (!"".equals(classname)) { this.classname = classname; } } + /** + * Set the file which must be present in the file system to set the given + * property. + * + * @param file the name of the file which is required. + */ public void setFile(String file) { this.file = file; } + /** + * Set the name of a Java resouirce which is required to set the property. + * + * @param resource the name of a resource which is required to be available. + */ public void setResource(String resource) { this.resource = resource; } @@ -154,14 +211,32 @@ public class Available extends Task implements Condition { this.type.setValue(type); } + /** + * Set what type of file is required - either a directory or a file. + * + * @param type an instance of the FileDir enumeratedAttribute indicating + * whether the file required is to be a directory or a plain + * file. + */ public void setType(FileDir type) { this.type = type; } + /** + * Set whether the search for classes should ignore the runtime classes and + * just use the given classpath. + * + * @param ignore true if system classes are to be ignored. + */ public void setIgnoresystemclasses(boolean ignore) { this.ignoreSystemclasses = ignore; } + /** + * Entry point when operating as a task. + * + * @exception BuildException if the task is not configured correctly. + */ public void execute() throws BuildException { if (property == null) { throw new BuildException("property attribute is required", @@ -185,14 +260,20 @@ public class Available extends Task implements Condition { } } + /** + * Evaluate the availability of a resource. + * + * @return boolean is the resource is available. + * @exception if the condition is not configured correctly + */ public boolean eval() throws BuildException { if (classname == null && file == null && resource == null) { throw new BuildException("At least one of (classname|file|" + "resource) is required", location); } - if (type != null){ - if (file == null){ + if (type != null) { + if (file == null) { throw new BuildException("The type attribute is only valid " + "when specifying the file " + "attribute.", location); @@ -422,24 +503,38 @@ public class Available extends Task implements Condition { } } + /** + * EnumeratedAttribute covering the file types to be checked for, either + * file or dir. + */ public static class FileDir extends EnumeratedAttribute { private static final String[] values = {"file", "dir"}; + /** + * @see EnumeratedAttribute#getValues + */ public String[] getValues() { return values; } + /** + * Indicate if the value specifies a directory. + * + * @return true if the value specifies a directory. + */ public boolean isDir() { return "dir".equalsIgnoreCase(getValue()); } + /** + * Indicate if the value specifies a file. + * + * @return true if the value specifies a file. + */ public boolean isFile() { return "file".equalsIgnoreCase(getValue()); } - public String toString() { - return getValue(); - } } } diff --git a/src/main/org/apache/tools/ant/taskdefs/Chmod.java b/src/main/org/apache/tools/ant/taskdefs/Chmod.java index 59f035e52..1941e66c0 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Chmod.java +++ b/src/main/org/apache/tools/ant/taskdefs/Chmod.java @@ -82,6 +82,9 @@ public class Chmod extends ExecuteOn { private boolean defaultSetDefined = false; private boolean havePerm = false; + /** + * Chmod task for setting file and directory permissions. + */ public Chmod() { super.setExecutable("chmod"); super.setParallel(true); diff --git a/src/main/org/apache/tools/ant/taskdefs/Cvs.java b/src/main/org/apache/tools/ant/taskdefs/Cvs.java index 46b5587c2..a92703d63 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Cvs.java +++ b/src/main/org/apache/tools/ant/taskdefs/Cvs.java @@ -74,7 +74,9 @@ package org.apache.tools.ant.taskdefs; */ public class Cvs extends AbstractCvsTask { + /** + * CVS Task - now implemented by the Abstract CVS Task base class + */ public Cvs() { - setTaskName("cvs"); } } diff --git a/src/main/org/apache/tools/ant/taskdefs/Deltree.java b/src/main/org/apache/tools/ant/taskdefs/Deltree.java index 15a9b037c..34f503512 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Deltree.java +++ b/src/main/org/apache/tools/ant/taskdefs/Deltree.java @@ -74,10 +74,21 @@ public class Deltree extends Task { private File dir; + /** + * Set the directory to be deleted + * + * @param dir the root of the tree to be removed. + */ public void setDir(File dir) { this.dir = dir; } + /** + * Do the work. + * + * @exception BuildException if the task is not configured correctly or + * the tree cannot be removed. + */ public void execute() throws BuildException { log("DEPRECATED - The deltree task is deprecated. " + "Use delete instead."); diff --git a/src/main/org/apache/tools/ant/taskdefs/Echo.java b/src/main/org/apache/tools/ant/taskdefs/Echo.java index 300e5f2e5..d041103f5 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Echo.java +++ b/src/main/org/apache/tools/ant/taskdefs/Echo.java @@ -163,6 +163,9 @@ public class Echo extends Task { } public static class EchoLevel extends EnumeratedAttribute { + /** + * @see EnumeratedAttribute#getValues + */ public String[] getValues() { return new String[] {"error", "warning", "info", "verbose", "debug"}; diff --git a/src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java b/src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java index 8768a277f..6792b4faa 100644 --- a/src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java +++ b/src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java @@ -420,6 +420,9 @@ public class ExecuteOn extends ExecTask { * for the type attribute. */ public static class FileDirBoth extends EnumeratedAttribute { + /** + * @see EnumeratedAttribute#getValues + */ public String[] getValues() { return new String[] {"file", "dir", "both"}; } diff --git a/src/main/org/apache/tools/ant/taskdefs/FixCRLF.java b/src/main/org/apache/tools/ant/taskdefs/FixCRLF.java index abee927af..ea32c8902 100644 --- a/src/main/org/apache/tools/ant/taskdefs/FixCRLF.java +++ b/src/main/org/apache/tools/ant/taskdefs/FixCRLF.java @@ -1036,6 +1036,9 @@ public class FixCRLF extends MatchingTask { * Enumerated attribute with the values "asis", "cr", "lf" and "crlf". */ public static class CrLf extends EnumeratedAttribute { + /** + * @see EnumeratedAttribute#getValues + */ public String[] getValues() { return new String[] {"asis", "cr", "lf", "crlf"}; } diff --git a/src/main/org/apache/tools/ant/taskdefs/Javac.java b/src/main/org/apache/tools/ant/taskdefs/Javac.java index 9971108da..fa069cf68 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Javac.java +++ b/src/main/org/apache/tools/ant/taskdefs/Javac.java @@ -143,6 +143,9 @@ public class Javac extends MatchingTask { private String source; private String debugLevel; + /** + * Javac task for compilation of Java files. + */ public Javac() { if (JavaEnvUtils.getJavaVersion() != JavaEnvUtils.JAVA_1_1 && JavaEnvUtils.getJavaVersion() != JavaEnvUtils.JAVA_1_2) { diff --git a/src/main/org/apache/tools/ant/taskdefs/Javadoc.java b/src/main/org/apache/tools/ant/taskdefs/Javadoc.java index 06a4bfbb9..7703be989 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Javadoc.java +++ b/src/main/org/apache/tools/ant/taskdefs/Javadoc.java @@ -108,7 +108,6 @@ import org.apache.tools.ant.util.JavaEnvUtils; * * @ant.task category="java" */ - public class Javadoc extends Task { public class DocletParam { diff --git a/src/main/org/apache/tools/ant/types/EnumeratedAttribute.java b/src/main/org/apache/tools/ant/types/EnumeratedAttribute.java index 418cf8baa..5f5196291 100644 --- a/src/main/org/apache/tools/ant/types/EnumeratedAttribute.java +++ b/src/main/org/apache/tools/ant/types/EnumeratedAttribute.java @@ -143,4 +143,15 @@ public abstract class EnumeratedAttribute { public final int getIndex() { return index; } + + + /** + * Convert the value to its string form. + * + * @return the string form of the value. + */ + public String toString() { + return getValue(); + } + }