Browse Source

Javadocs

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@272455 13f79535-47bb-0310-9956-ffa450edef68
master
Conor MacNeill 23 years ago
parent
commit
9a82620775
11 changed files with 154 additions and 8 deletions
  1. +13
    -0
      src/main/org/apache/tools/ant/taskdefs/Ant.java
  2. +101
    -6
      src/main/org/apache/tools/ant/taskdefs/Available.java
  3. +3
    -0
      src/main/org/apache/tools/ant/taskdefs/Chmod.java
  4. +3
    -1
      src/main/org/apache/tools/ant/taskdefs/Cvs.java
  5. +11
    -0
      src/main/org/apache/tools/ant/taskdefs/Deltree.java
  6. +3
    -0
      src/main/org/apache/tools/ant/taskdefs/Echo.java
  7. +3
    -0
      src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java
  8. +3
    -0
      src/main/org/apache/tools/ant/taskdefs/FixCRLF.java
  9. +3
    -0
      src/main/org/apache/tools/ant/taskdefs/Javac.java
  10. +0
    -1
      src/main/org/apache/tools/ant/taskdefs/Javadoc.java
  11. +11
    -0
      src/main/org/apache/tools/ant/types/EnumeratedAttribute.java

+ 13
- 0
src/main/org/apache/tools/ant/taskdefs/Ant.java View File

@@ -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;
}


+ 101
- 6
src/main/org/apache/tools/ant/taskdefs/Available.java View File

@@ -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
* <a href="mailto:stefano@apache.org">stefano@apache.org</a>
@@ -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();
}
}
}

+ 3
- 0
src/main/org/apache/tools/ant/taskdefs/Chmod.java View File

@@ -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);


+ 3
- 1
src/main/org/apache/tools/ant/taskdefs/Cvs.java View File

@@ -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");
}
}

+ 11
- 0
src/main/org/apache/tools/ant/taskdefs/Deltree.java View File

@@ -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.");


+ 3
- 0
src/main/org/apache/tools/ant/taskdefs/Echo.java View File

@@ -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"};


+ 3
- 0
src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java View File

@@ -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"};
}


+ 3
- 0
src/main/org/apache/tools/ant/taskdefs/FixCRLF.java View File

@@ -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"};
}


+ 3
- 0
src/main/org/apache/tools/ant/taskdefs/Javac.java View File

@@ -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) {


+ 0
- 1
src/main/org/apache/tools/ant/taskdefs/Javadoc.java View File

@@ -108,7 +108,6 @@ import org.apache.tools.ant.util.JavaEnvUtils;
*
* @ant.task category="java"
*/

public class Javadoc extends Task {

public class DocletParam {


+ 11
- 0
src/main/org/apache/tools/ant/types/EnumeratedAttribute.java View File

@@ -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();
}

}

Loading…
Cancel
Save