ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@locus.apache.org
Subject cvs commit: jakarta-ant/src/main/org/apache/tools/ant/taskdefs Property.java
Date Wed, 27 Sep 2000 15:09:04 GMT
bodewig     00/09/27 08:09:00

  Modified:    docs     index.html
               src/main/org/apache/tools/ant/taskdefs Property.java
  Log:
  Added a refid attribute to property.
  Submitted by:	Vincent Bergbauer <vincent_bergbauer@yahoo.com>
  
  Revision  Changes    Path
  1.117     +9 -2      jakarta-ant/docs/index.html
  
  Index: index.html
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/docs/index.html,v
  retrieving revision 1.116
  retrieving revision 1.117
  diff -u -r1.116 -r1.117
  --- index.html	2000/09/26 07:18:51	1.116
  +++ index.html	2000/09/27 15:08:46	1.117
  @@ -3186,9 +3186,10 @@
   property cannot be set, and will be ignored. This means that properties set
   outside the current project always override the properties of the current
   project.</p>
  -<p>There are three ways to set properties:</p>
  +<p>There are four ways to set properties:</p>
   <ul>
     <li>By supplying both the <i>name</i> and <i>value</i>
attribute.</li>
  +  <li>By supplying both the <i>name</i> and <i>refid</i>
attribute.</li>
     <li>By setting the <i>file</i> attribute with the filename of the property
       file to load. This property file has the format as defined by the file used
       in the class java.util.Properties.</li>
  @@ -3217,7 +3218,13 @@
     <tr>
       <td valign="top">value</td>
       <td valign="top">the value of the property.</td>
  -    <td valign="middle" align="center" rowspan="3">Yes</td>
  +    <td valign="middle" align="center" rowspan="4">Yes</td>
  +  </tr>
  +  <tr>
  +    <td valign="top">refid</td>
  +    <td valign="top"><a href="#references">Reference</a> to an object
  +      defined elsewhere. Only yields reasonable results for references
  +      to <a href="#path">PATH like structures</a> or properties.</td>
     </tr>
     <tr>
       <td valign="top">resource</td>
  
  
  
  1.17      +21 -0     jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Property.java
  
  Index: Property.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Property.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- Property.java	2000/09/18 07:55:01	1.16
  +++ Property.java	2000/09/27 15:08:53	1.17
  @@ -55,6 +55,7 @@
   package org.apache.tools.ant.taskdefs;
   
   import org.apache.tools.ant.*;
  +import org.apache.tools.ant.types.Reference;
   import java.io.*;
   import java.util.*;
   
  @@ -72,6 +73,7 @@
       String value;
       File file;
       String resource;
  +    private Reference ref = null;
   
       boolean userProperty=false; // set read-only properties
   
  @@ -99,6 +101,14 @@
           return file;
       }
   
  +    public void setRefid(Reference ref) {
  +        this.ref = ref;
  +    }
  +
  +    public Reference getRefid() {
  +        return ref;
  +    }
  +
       public void setResource(String resource) {
           this.resource = resource;
       }
  @@ -107,6 +117,10 @@
           return resource;
       }
   
  +    public String toString() {
  +        return value == null ? "" : value;
  +    }
  +
       public void execute() throws BuildException {
           try {
               if ((name != null) && (value != null)) {
  @@ -116,6 +130,13 @@
               if (file != null) loadFile(file);
   
               if (resource != null) loadResource(resource);
  +
  +            if ((name != null) && (ref != null)) {
  +                Object obj = ref.getReferencedObject(getProject());
  +                if (obj != null) {
  +                    addProperty(name, obj.toString());
  +                }
  +            }
   
           } catch (Exception e) {
               throw new BuildException(e, location);
  
  
  

Mime
View raw message