1. Yes, Property should have a toString method. I
should have thought about it. Anything that can be
referenced should have a toString method.
2. Use of diff. I am sorry, but I am quite new at
this.
Is this the format you need?
@@ -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;
+ }
+
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);
--- Stefan Bodewig <[EMAIL PROTECTED]> wrote:
> Would one expect that given
>
> <property name="dummy" id="dummyId" value="test" />
>
> the following two constructs yield the same result
>
> <property name="dummy2" value="${dummy}" />
> <property name="dummy2" refid="dummyId" />
>
> i.e. should Property get a toString method returning
> the value of the
> property?
>
> Stefan
>
> PS: Vincent, please send a "diff -u" next time, a
> lot easier to apply
> than copy/pasting code.
__________________________________________________
Do You Yahoo!?
Send instant messages & get email alerts with Yahoo! Messenger.
http://im.yahoo.com/