Return-Path: Mailing-List: contact user-help@ant.apache.org; run by ezmlm Delivered-To: mailing list user@ant.apache.org Received: (qmail 89444 invoked from network); 13 May 2003 08:19:56 -0000 Received: from k100-37.bas1.dbn.dublin.eircom.net (HELO corvil.com.) (159.134.100.37) by daedalus.apache.org with SMTP; 13 May 2003 08:19:56 -0000 Received: from preilly.local.corvil.com (preilly.local.corvil.com [172.18.1.173]) by corvil.com. (8.12.5/8.12.5) with ESMTP id h4D8K1pg037996 for ; Tue, 13 May 2003 09:20:03 +0100 (IST) (envelope-from peter.reilly@corvil.com) Content-Type: text/plain; charset="iso-8859-1" From: peter reilly Organization: corvil To: Ant Users List Subject: Re: Custom data type problem Date: Tue, 13 May 2003 09:24:11 +0100 User-Agent: KMail/1.4.3 References: In-Reply-To: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200305130924.11469.peter.reilly@corvil.com> X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N Sorry, I still do not see the problem.. I tried your code and addText() has been called before addConfiguredValue() is called. :MyData2.java: import org.apache.tools.ant.types.DataType; public class MyData2 extends DataType { private String id; private String text; private MyValue2 value; public MyData2() { } public void addConfiguredValue( MyValue2 value ) { System.out.println( "MyData2: AddConfiguredValue: value is " + value.toString()); text =3D value.toString(); this.value =3D value; } public void setId( String id ) { this.id =3D id; } public String getId() { return id; } public String toString() { System.out.println( "text is " + text + " Late resolve: "+value ); return text; } } :MyValue2.java: import org.apache.tools.ant.Task; import org.apache.tools.ant.types.Reference; public class MyValue2 extends Task { private StringBuffer sb =3D new StringBuffer(); private Reference id; public void addText(String text) { sb.append( text ); } public void setUseData( Reference id ) { this.id =3D id; } public String toString() { if( id !=3D null ) { return ((MyData2)id.getReferencedObject( getProject() )).toString(); } if( sb.length() =3D=3D 0 ) { return null; } return sb.toString(); } } :MyExec2.java: import org.apache.tools.ant.Task; public class MyExec2 extends Task { public void addConfiguredValue(MyValue2 v) { System.out.println("v is " + v); } } :build.xml: value 1 value 2 :output is: [delete] Deleting directory /home/preilly/proj/learning/custom/classes [mkdir] Created dir: /home/preilly/proj/learning/custom/classes [javac] Compiling 6 source files to=20 /home/preilly/proj/learning/custom/classes [mydata2] MyData2: AddConfiguredValue: value is value 1 [mydata2] MyData2: AddConfiguredValue: value is value 2 [mydata2] text is value 2 Late resolve: value 2 [myexec2] text is value 2 Late resolve: value 2 [myexec2] v is value 2 Peter. On Monday 12 May 2003 17:44, Tony Thompson wrote: > I am not having an issue with multiple values. I was just saying that = I > couldn't do something like this: > > Value 1. > > because I need to be able to keep track of individual values, like > this: > > > Value 1. > Value 2. > Value 3. > > > I can keep track of the individual values without an issue. The > problem is when I addConfiguredValue() to "data", the addText() method > of "value" hasn't executed yet so, addConfiguredValue() thinks the > "value" is null. The modified example that I sent demonstrates the > issue. If I hold on to "value" until later, addText() has been called > and it works. > > Tony