From b42831ce4ba16fe36ace42e62a465b0055d0de83 Mon Sep 17 00:00:00 2001
From: Stefan Bodewig
Date: Thu, 14 Sep 2000 10:49:55 +0000
Subject: [PATCH] Added value attribute to . Submitted by: Glenn
McAllister
git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@267991 13f79535-47bb-0310-9956-ffa450edef68
---
docs/index.html | 10 ++++++++--
src/main/org/apache/tools/ant/taskdefs/Available.java | 10 ++++------
src/main/org/apache/tools/ant/taskdefs/KeySubst.java | 4 +++-
3 files changed, 15 insertions(+), 9 deletions(-)
diff --git a/docs/index.html b/docs/index.html
index 882d64ab1..2d6912498 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -961,8 +961,9 @@ listed as #IMPLIED
.
Description
Sets a property if a resource is available at runtime. This resource can be a
file resource, a class in classpath or a JVM system resource.
-The value part of the properties being set is true if the resource is
-present, otherwise, the property is not set.
+If the resource is present, the property value is set to true by
+default, otherwise the property is not set. You can set the value to
+something specific by using the value attribute.
Normally, this task is used to set properties that are useful to avoid target
execution depending on system parameters.
Parameters
@@ -977,6 +978,11 @@ execution depending on system parameters.
the name of the property to set. |
Yes |
+
+ value |
+ the value to set the property to. Defaults to "true". |
+ No |
+
classname |
the class to look for in classpath. |
diff --git a/src/main/org/apache/tools/ant/taskdefs/Available.java b/src/main/org/apache/tools/ant/taskdefs/Available.java
index d72e1b344..ce62020ea 100644
--- a/src/main/org/apache/tools/ant/taskdefs/Available.java
+++ b/src/main/org/apache/tools/ant/taskdefs/Available.java
@@ -70,16 +70,14 @@ public class Available extends Task {
private String classname;
private File file;
private String resource;
+ private String value = "true";
public void setProperty(String property) {
this.property = property;
}
- public void XsetClass(String classname) {
- log("The class attribute is deprecated. " +
- "Please use the classname attribute.",
- Project.MSG_WARN);
- this.classname = classname;
+ public void setValue(String value) {
+ this.value = value;
}
public void setClassname(String classname) {
@@ -99,7 +97,7 @@ public class Available extends Task {
if ((file != null) && !checkFile(file)) return;
if ((resource != null) && !checkResource(resource)) return;
- this.project.setProperty(property, "true");
+ this.project.setProperty(property, value);
}
private boolean checkFile(File file) {
diff --git a/src/main/org/apache/tools/ant/taskdefs/KeySubst.java b/src/main/org/apache/tools/ant/taskdefs/KeySubst.java
index 369804938..91ba077b6 100644
--- a/src/main/org/apache/tools/ant/taskdefs/KeySubst.java
+++ b/src/main/org/apache/tools/ant/taskdefs/KeySubst.java
@@ -65,6 +65,8 @@ import java.util.*;
* setKeys method to understand how to do the substitutions.
*
* @author Jon S. Stevens jon@clearink.com
+ *
+ * @deprecated KeySubst is deprecated. Use Filter + CopyDir instead.
*/
public class KeySubst extends Task {
private File source = null;
@@ -200,4 +202,4 @@ public class KeySubst extends Task {
finalString.append (origString.substring(i));
return finalString.toString();
}
-}
\ No newline at end of file
+}